Add or Change Macro Shortcuts

When you record a macro (Tools>Macro>Record New Macro) you have the option of assigning a shortcut key. A shortcut key allows you to run the macro with a key combination, such as Control+Shift+i. To change an existing shortcut or to create a shortcut for a macro that doesn’t have one, start by opening the Macro dialog (Alt+F8)

Shortcut1

Click on the Options button and enter the desired shortcut.

Shortcut2

In this example, I entered a capital S. Beware that existing Excel functions have shortcuts assigned to them. Had I entered a lower case ‘s’, Control+S would have been the shortcut and would no longer be the shortcut to Save the active workbook.

Posted in Uncategorized

3 thoughts on “Add or Change Macro Shortcuts

  1. Dick,

    You can also add a shortcut key to a macro using code.

    The following code adds Shortcut key “CTRL+SHIFT+H” to a macro called “HideRows”

    Application.MacroOptions Macro:=”HideRows”, _
    HasShortcutKey:=True, ShortcutKey:=”H”

    Ken Lepper

  2. How can I hide rows with zero values resulting from a formula, but not rows that have intentionally been left blank within the spreadsheet?

    Any help is much appreciated!!

    hko


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.