I have a simple macro that toggles the color of selected cells. If I run it from the debugger, it works fine. However I have been unsuccessful in creating a keystroke combination for it. I am using Excel 2011 on a MacBook Pro and my Excel files are .xlsm. My macro workbook and the macros are all xlsm.
I have tried many different keystroke combinations using CTRL-CMD-letter.
I cant find any single letter that works. I also tried ONKEY and tried to define a key to simulate the ENTER key since there is no ENTER key on a MacBook Pro.
Here is the macro that works from the debugger:
Sub YellowCell()
'Toggles selection between yellow cell and plain cell
With Selection.Interior
If .ColorIndex = 6 _
Then .ColorIndex = 2 _
Else: .ColorIndex = 6
.Pattern = xlSolid
End With
Selection.Borders.Color = RGB(196, 196, 196)
End Sub
I have tried several different versions of OnKey, none of which work. Here is a sample:
Application.OnKey "{FUNCTION}{Q_KEY}", "YellowCell"
I've been working on this for months. In Personal Macro Notebook using xls files of prior EXCEL versions I used the key combination of CMD-CTRL-q to run Yellow
cell flawlessly.
Bookmarks