Excel 2010 VBA to assign a shortcut key

Application.OnKey “^j”, “subroutineToRun”

This runs the subroutine named subroutineToRun when CTRL+j is pressed.
The macros must be run once before the shortcut will work.

Here’s a full list of other keys

VBA Assign Shortcut key reference

VBA Assign Shortcut key reference

To deassign/release the shortcut leave the Procedure empty
Application.OnKey “%b”, “”

Disable Save (Ctrl S)
Application.OnKey “^s”, “”

Leave a Reply

Your email address will not be published. Required fields are marked *