Add shortcut keystroke to existing macro?

  • Thread starter Thread starter Ed
  • Start date Start date
E

Ed

Is there a simple line of code I can add to an existing macro to assign a
shortcut keystroke to it?

Thank you.
Ed
 
You can permanently assign a Ctrl shortcut to a macro (as long as you save
the workbook after running this) like this:

Application.MacroOptions Macro:="Test",ShortcutKey:="j"

or you can use OnKey to make it last for just the current Excel session:

Application.OnKey "^j", "Test"
 
Back
Top