ARCHIVED: In Microsoft Excel, how do I assign a shortcut key to a macro?
This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.
In Microsoft Excel, it is often easier to assign a macro to a shortcut
key combination (e.g., in Windows, Ctrl-r
, and in
Mac OS X, Option-Command-r
) than to a
button. You can assign the key when you create the macro or after
you've created it. Follow the appropriate directions below.
Assigning a shortcut to a new macro
- In Excel 2010 and 2007, from the
Record Macro
dialog box will appear.In Excel 2003 and earlier, from the
menu, select , and then . tab, click
, and then select . The
- In the "Macro name:" field, enter a name for your macro.
- In the "Shortcut key:" field, choose the key you would like to
press in conjunction with the
Ctrl
key (in Mac OS X,Option-Command
) to trigger the macro. This can be any key, but you should check the key combination before assigning it to a macro. Excel has some predefined key combinations that you will erase if you assign one of your macros to the same key. - The save/store option allows you to choose where you would like to store the macro and key combination. If the macro is document-specific, from the drop-down menu, choose . If you would like to save the macro and key in a new workbook, choose . If you would like to save the macro to your permanent macro workbook, choose . This will keep the macro and key combination active no matter what you are working on.
- Click , and then create your macro as usual.
Assigning a shortcut to an existing macro
- In Excel 2010 and 2007, from the
In Excel 2003 and earlier, from the
menu, select , and then . tab, click
, and then select .
- A dialog box containing all macros in all open workbooks will appear. Click the macro for which you would like to create a key combination, and the name will appear in the field on top of the list.
- Click . A dialog box that contains information about the macro will open.
- In the "Shortcut Key:" field, enter the key you wish to assign in
conjunction with the
Ctrl
key (in Mac OS X,Option-Command
) to trigger the macro. This can be any key, but you should check the key combination before assigning it to a macro. Excel has some predefined key combinations that you will erase if you assign one of your macros to the same key. - Click as needed to close any open dialog boxes.
This is document ahbm in the Knowledge Base.
Last modified on 2018-01-18 12:48:02.