+ means shift
^ means ctrl
'This goes to ThisWorkbook
Private Sub Workbook_Open()
Application.OnKey "+^C", "cycleColor"
End Sub
'This goes to regular module
Public Sub cycleColor()
Static col As String
If col = "" Then
col = "Blue"
ElseIf col = "Blue" Then
col = "Green"
ElseIf col = "Green" Then
col = "Red"
ElseIf col = "Red" Then
col = "Blue"
End If
Debug.Print col
End Sub
Here is shown how you can do it. Maybe there are better ways. You can use UDT to group variables:
Public Type colors
blue as String
red As String
green As String
End Type
And then assign value like colors.blue = Value.
Then in following code use
If col=colors.blue Then
col=colors.red
End if
Bookmarks