|
▼ロケットマン さん:
こんな感じでしょうか
>
'ThisWorkbookモジュール
Option Explicit
Private Sub Workbook_Open()
Application.OnKey "^+W", "ChangeCellColor"
Application.OnKey "^+E", "ChangeCellColor2"
Application.OnKey "^+C", "ChangeCellColor3"
End Sub
'標準モジュール
Option Explicit
Sub ChangeCellColor()
Static changeCount As Integer
If TypeName(Selection) <> "Range" Then Exit Sub
changeCount = changeCount + 1
Select Case changeCount
Case 1
Selection.Interior.Color = RGB(255, 255, 0) ' 黄色
Case 2
Selection.Interior.Color = RGB(255, 165, 0) ' オレンジ
Case 3
Selection.Interior.Color = RGB(255, 204, 0) ' 濃い黄色
changeCount = 0 ' カウントをリセット
End Select
End Sub
Sub ChangeCellColor2()
Static changeCount As Integer
If TypeName(Selection) <> "Range" Then Exit Sub
changeCount = changeCount + 1
Select Case changeCount
Case 1
Selection.Interior.Color = RGB(204, 0, 255) ' 紫
Case 2
Selection.Interior.Color = RGB(202, 237, 251) ' 水色
Case 3
Selection.Interior.Color = RGB(0, 0, 255) ' 青
changeCount = 0 ' カウントをリセット
End Select
End Sub
Sub ChangeCellColor3()
If TypeName(Selection) <> "Range" Then Exit Sub
Selection.Interior.ColorIndex = xlColorIndexNone
End Sub
|
|