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)
Click on the Options button and enter the desired shortcut.
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.
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
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
Thank Ken, your snippet helped me 13 years after you posted it!