The quickest shortcut for a macro in Excel is Alt+F8 to open the Macro dialog, then Alt+R to run the selected macro. For an even faster one-key run, assign a shortcut key (like Ctrl+Shift+M) when you record the macro, or use a Quick Access Toolbar button. This article explains every shortcut method, how to set them up, and how to fix common issues.
What Is a Macro Shortcut?
A macro shortcut is a keyboard combination or button that runs a recorded or written VBA macro without navigating menus. Excel offers three built-in ways to trigger a macro: the Alt+F8 dialog, a custom shortcut key you assign during recording or in the Macro Options, and a Quick Access Toolbar (QAT) button. Each has trade-offs in speed and convenience.
How to Assign a Shortcut Key to a Macro
You can assign a shortcut key when recording a macro or later via the Macro dialog. Here’s the step-by-step for Microsoft 365 on Windows:
- Go to View > Macros > View Macros (or press Alt+F8).
- Select the macro name in the list.
- Click Options.
- In the Shortcut key box, type a letter (e.g.,
m). Excel automatically adds Ctrl+ before it, so you get Ctrl+Shift+M if you type an uppercase letter, or Ctrl+M if lowercase. - Click OK, then Cancel to close the dialog.
On a Mac (Excel for Microsoft 365), the process is similar: go to Tools > Macro > Macros, select the macro, click Options, and enter a shortcut letter. Note that Mac uses Command instead of Ctrl, so a shortcut like Command+Shift+M works.
If the macro was recorded, you can also set the shortcut during recording: in the Record Macro dialog, there is a Shortcut key field. However, you cannot assign a shortcut that conflicts with Excel’s built-in shortcuts (like Ctrl+C for copy) – Excel will warn you but may still allow it, which can cause unexpected behavior.
Using Alt+F8: The Universal Shortcut
The most reliable shortcut is Alt+F8, which opens the Macro dialog. From there, you can run any macro by selecting it and pressing Enter (or clicking Run). This works for all macros, regardless of whether they have a custom shortcut. On a Mac, the equivalent is Option+F8 (or Fn+Option+F8 on some keyboards).
To make it even faster, you can type the first letter of the macro name after pressing Alt+F8 – Excel highlights the first matching macro, and pressing Enter runs it. For example, if you have a macro named FormatReport, press Alt+F8, type F, then Enter.
Quick Access Toolbar Button: One-Click Run
If you prefer a mouse click, add the macro to the Quick Access Toolbar (QAT) – the small toolbar at the top-left of the Excel window. This is especially useful for macros you run frequently.
- Click the Customize Quick Access Toolbar arrow (the down arrow at the end of the QAT).
- Choose More Commands.
- In the Choose commands from dropdown, select Macros.
- Select your macro and click Add.
- Click OK. The macro now appears as a button on the QAT.
You can also assign a keyboard shortcut to the QAT button itself: press Alt and you’ll see numbers/letters appear on the QAT icons – pressing the corresponding key runs the macro. For example, if your macro button shows 1, pressing Alt+1 runs it.
Common Problems and Fixes
Several issues can prevent a macro shortcut from working:
- Shortcut conflict: If your shortcut (e.g., Ctrl+M) is already used by Excel (like Ctrl+M for merge cells in some versions), Excel may not run the macro. Use a combination like Ctrl+Shift+Letter to avoid conflicts.
- Macro security: If macros are disabled, shortcuts won’t work. Go to File > Options > Trust Center > Trust Center Settings > Macro Settings and choose Disable VBA macros with notification (recommended) or Enable all macros (only if you trust the file).
- Workbook not saved as macro-enabled: If you save as .xlsx, macros are stripped. Save as .xlsm (Excel Macro-Enabled Workbook) to keep the shortcut.
- Shortcut only works in that workbook: By default, shortcuts are stored with the workbook. If you want it to work in all workbooks, store the macro in your Personal Macro Workbook (see below).
- Mac not recognizing Ctrl: On Mac, use Command instead of Ctrl. If you recorded a macro on Windows and are using it on Mac, the shortcut may not transfer – reassign it in the Macro Options.
Making Shortcuts Work Everywhere: Personal Macro Workbook
If you want a macro (and its shortcut) to be available in all your Excel files, store it in the Personal Macro Workbook. This is a hidden workbook that loads every time Excel starts.
- Record a macro (or copy code) into the Personal Macro Workbook: In the Record Macro dialog, under Store macro in, select Personal Macro Workbook.
- Excel creates a file named
PERSONAL.XLSBin your XLStart folder. - After recording, go to View > Unhide to see it, then edit the macro and assign a shortcut via the Macro Options as described above.
Now the shortcut works in any open workbook. Note that the Personal Macro Workbook is a hidden file – don’t delete it accidentally.
Alternatives to Keyboard Shortcuts
If you don’t want to remember shortcuts, consider these alternatives:
- Assign to a shape or button: Insert a shape (e.g., a rectangle) from Insert > Shapes, right-click it, choose Assign Macro, and select your macro. Clicking the shape runs it.
- Use a custom ribbon tab: Create a custom tab in File > Options > Customize Ribbon, add a macro button there. This is more permanent than the QAT.
- Run from the Developer tab: If you have the Developer tab enabled (File > Options > Customize Ribbon), you can click Macros there, but that’s slower than Alt+F8.
Frequently Asked Questions
Can I use Ctrl+Enter as a macro shortcut? No – Excel reserves Ctrl+Enter for filling a selection with the current entry. If you try to assign it, Excel will show a warning, and the shortcut may not work. Stick to Ctrl+Shift+Letter or Ctrl+Alt+Letter.
Why does my macro shortcut not work after reopening the file? This usually happens because the macro is not enabled (security settings) or the workbook is saved as .xlsx. Re-save as .xlsm and enable macros when prompted.
Can I assign the same shortcut to two different macros? No, Excel only allows one macro per shortcut key. If you assign a duplicate, the newer assignment overwrites the older one, but it’s best to avoid duplicates to prevent confusion.
How do I remove a macro shortcut? Open the Macro dialog (Alt+F8), select the macro, click Options, and delete the letter from the Shortcut key field. Click OK.
Is there a shortcut to record a macro? Yes – press Alt+T+M+R (in sequence) to open the Record Macro dialog. On Mac, it’s Option+T+M+R. After recording, press Alt+T+M+R again to stop.
Can I run a macro with a single key like F9? No, Excel does not allow function keys as macro shortcuts. You can only use Ctrl or Ctrl+Shift plus a letter. For a single-key run, use a QAT button (press Alt+number) or a shape click.
Safety and Accuracy Notes
Macros can contain code that changes your data or system. Only run macros from trusted sources, and always save a copy of your workbook before running a macro that you didn’t write yourself – macros cannot be undone with Ctrl+Z. If you’re using a shortcut that you didn’t assign, check the macro code first via Alt+F8 > Edit to see what it does.
Related
- JavaScript Random Number in Range: Simple Guide
- Alt Shortcut Keys: The Complete List & How to Use Them
- Data Entry Software Programs: Types & Picks
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Excel VBA InputBox Choices: Menus, Buttons, and FormsExcel VBA’s standard InputBox asks users to type a response; it does not create a dropdown or a…
- Excel VBA Functions: How They Work and When to Use ThemExcel VBA functions are procedures that perform a calculation or task and return a result; you can write…
- Excel UserForm TextBox Date Format: dd/mm/yyyyTo display a date as dd/mm/yyyy in an Excel VBA UserForm TextBox, validate the text and format it…
- Excel UserForm Layout: Design, Controls, and Setup TipsAn Excel UserForm layout is the arrangement of the form window and its controls—such as text boxes, labels,…
- Case in VBA: Select, Activate, and Workbooks ExplainedIn VBA, “Case” most commonly refers to the Select Case statement, a conditional branching structure that runs different…
- Can You Make Macros in Google Sheets? How They WorkYes. You can make macros in Google Sheets by recording a sequence of actions in the browser; Sheets…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.