In my Excel workbook, I am trying to create a keyboard shortcut. I have chosen to use Ctrl-Alt-G, because it appears Excel is not already using it.
In the Workbook_Activate sub, I am calling a sub called AssignShortcuts. Here it is.
This sub is in a standard module, and LoadGroupsUF is in a standard module.
I put in the MsgBox line to confirm the code is running when the workbook is opened. It is.
I put a breakpoint on the first line of LoadGroupsUF. That way, if it is every called, the code should stop. I then tried pressing Ctrl-Alt-G. Nothing. I tried multiple times. Nada. I saved & closed the file, reopened it, and tried again. Still nothing. Obviously I'm doing something wrong, but I'm not sure what.
In the Workbook_Activate sub, I am calling a sub called AssignShortcuts. Here it is.
VBA Code:
Sub AssignShortcuts()
'This is supposed to set Ctrl-Alt-G to open a UserForm.
Application.OnKey "^%G", "LoadGroupsUF"
MsgBox "AssignShortcuts has run!"
End Sub
This sub is in a standard module, and LoadGroupsUF is in a standard module.
I put in the MsgBox line to confirm the code is running when the workbook is opened. It is.
I put a breakpoint on the first line of LoadGroupsUF. That way, if it is every called, the code should stop. I then tried pressing Ctrl-Alt-G. Nothing. I tried multiple times. Nada. I saved & closed the file, reopened it, and tried again. Still nothing. Obviously I'm doing something wrong, but I'm not sure what.