excel macro 便利ツール
Posted On 2019年6月15日
ctrl+r 赤文字
ctrl+b 青文字
ctrl+y 黄色網掛け
ctrl+q 色をクリア
ctrl+g グレイ網掛け
ctrl+u a=>A
ctrl+d A=>a
Sub Macro1()
‘
‘ Macro1 Macro
‘
‘ Keyboard Shortcut: Ctrl+r
‘
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
End Sub
Sub Macro2()
‘
‘ Macro2 Macro
‘
‘ Keyboard Shortcut: Ctrl+b
‘
With Selection.Font
.Color = -4165632
.TintAndShade = 0
End With
End Sub
Sub Macro3()
‘
‘ Macro3 Macro
‘
‘ Keyboard Shortcut: Ctrl+y
‘
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End Sub
Sub Macro4()
‘
‘ Macro4 Macro
‘
‘ Keyboard Shortcut: Ctrl+q
‘
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
End Sub
Sub Macro5()
‘
‘ Macro5 Macro
‘
‘ Keyboard Shortcut: Ctrl+g
‘
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.349986266670736
.PatternTintAndShade = 0
End With
End Sub
Sub Macro6()
‘
‘ Macro6 Macro
‘
‘ Keyboard Shortcut: Ctrl+u
‘
‘ 変数定義
Dim targetCell As Range
' 選択したセル範囲を順次処理
For Each targetCell In Selection.Cells
' 大文字に変換
targetCell.Value = StrConv(targetCell.Value, vbUpperCase)
Next
End Sub
Sub Macro7()
‘
‘ Macro7 Macro
‘
‘ Keyboard Shortcut: Ctrl+d
‘
‘ 変数定義
Dim targetCell As Range
' 選択したセル範囲を順次処理
For Each targetCell In Selection.Cells
' 小文字に変換
targetCell.Value = StrConv(targetCell.Value, vbLowerCase)
Next
End Sub
Sub Macro8()
'
' Macro8 Macro
'aaa_bbb=>aaaBbb
' Keyboard Shortcut: Ctrl+j
'
' 変数定義
Dim targetCell As Range
Dim str As String
Dim strDe As String
Dim i As Long
' 選択したセル範囲を順次処理
For Each targetCell In Selection.Cells
strDe = ""
str = ""
str = targetCell.Value
For i = 1 To Len(str)
If Mid(str, i, 1) = "_" Then
i = i + 1
strDe = strDe & StrConv(Mid(str, i, 1), vbUpperCase)
'StrConv(targetCell.Value, vbUpperCase)
Else
strDe = strDe & Mid(str, i, 1)
End If
Next i
' 小文字に変換
targetCell.Value = strDe
Next
End Sub