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

  1. In Excel 2010 and 2007, from the View tab, click Macros, and then select Record Macro.... The Record Macro dialog box will appear.

    In Excel 2003 and earlier, from the Tools menu, select Macro, and then Record New Macro....

  2. In the "Macro name:" field, enter a name for your macro.
  3. 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.
  4. 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 This Workbook. If you would like to save the macro and key in a new workbook, choose New Workbook. If you would like to save the macro to your permanent macro workbook, choose Personal Macro Workbook. This will keep the macro and key combination active no matter what you are working on.
  5. Click OK, and then create your macro as usual.

Assigning a shortcut to an existing macro

  1. In Excel 2010 and 2007, from the View tab, click Macros, and then select View Macros.

    In Excel 2003 and earlier, from the Tools menu, select Macro, and then Macros....

  2. 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.
  3. Click Options.... A dialog box that contains information about the macro will open.
  4. 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.
  5. Click OK 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.