Alt+F8 in Excel: How to Open the Macro Dialog Box
In this article
Pressing Alt+F8 in Excel opens the Macro dialog box, letting you view, run, edit, or delete macros stored in the current workbook or add-ins. This shortcut works only if macros are enabled and at least one macro exists in the open file or in an add-in. No setup is required beyond having macros available and enabling them if blocked.
What You'll Need
- Microsoft Excel installed (2010 or later)
- A workbook with at least one saved macro (VBA code)
- Macros enabled in Excel’s security settings
Step-by-Step
- Open the Excel workbook that contains the macro you want to manage. If no macros exist in the file, Alt+F8 will still open the dialog but will show an empty list or only macros from add-ins.
- Ensure the workbook is not in read-only mode. If you see a yellow bar at the top saying "Protected View" or "Read-Only", click "Enable Editing" first.
- Press and hold the Alt key on your keyboard. While holding Alt, press the F8 key. Do not release Alt until after F8 is pressed. This combination triggers the Macro dialog box.
- Wait for the Macro dialog box to appear. It will list all available macros in the current workbook and any loaded add-ins. If no macros appear, check that macros are enabled and that the file contains VBA code.
- From the list, select the macro you wish to run, edit, or delete. To run it, click "Run". To edit, click "Edit" (this opens the Visual Basic Editor). To delete, click "Delete".
- If you’re editing a macro, the Visual Basic Editor window will open. Make your changes to the code, then save the workbook as a macro-enabled file (.xlsm) if it isn’t already.
- Close the Macro dialog box or Visual Basic Editor when done. Always save your workbook before closing if you made changes to macros.
Common Mistakes
- Pressing Alt and F8 separately instead of simultaneously — this may trigger other Alt shortcuts (like Alt+F for File menu) and not open the Macro dialog.
- Trying to use Alt+F8 on a workbook that has no macros — the dialog opens but shows nothing, leading users to believe the shortcut is broken.
- Working in a .xlsx file (non-macro-enabled) after pasting VBA code — Excel will not save macros in this format, so they disappear when reopening the file.
- Having macros disabled in Excel’s Trust Center settings — the shortcut still works, but no macros appear in the list because Excel blocks them from loading.
- Using a laptop without a dedicated F8 key or with function lock enabled — some laptops require pressing Fn+Alt+F8 instead of just Alt+F8.
Tips
- Always save your workbook as .xlsm (Excel Macro-Enabled Workbook) before closing if you’ve created or edited any macros — otherwise, VBA code is lost permanently.
- If you frequently use a macro, assign it to a button on the Quick Access Toolbar or a keyboard shortcut via the Macro Options dialog after opening Alt+F8.
- Use Alt+F8 regularly to review your macros — it helps you identify unused or duplicate code that can slow down your workbook.
- When sharing workbooks with macros, always include a note reminding recipients to enable content when prompted — this avoids confusion when macros don’t run.
- Test your macros in a copy of the file first. Editing macros directly in production files risks corruption if code contains errors.
- If you see "Macro security warning" when opening a file, always verify the source before clicking "Enable Content" — malicious macros can harm your system.
Troubleshooting
- Alt+F8 does nothing: First, check if your keyboard is functioning. Try typing other Alt+key combinations (like Alt+F for File menu). If those don’t work, your keyboard may be faulty or stuck in a mode (e.g., Fn lock). Try an external keyboard on desktop or disable Fn lock on laptops.
- Macro dialog opens but is empty: Confirm your workbook contains macros by pressing Alt+F11 to open the Visual Basic Editor. If no modules or classes appear under "VBAProject", your file has no macros. Re-save the file as .xlsm if you recently pasted code.
- "Edit" and "Delete" are grayed out: This typically means the macro is from a protected add-in or external file you don’t have edit rights to. You can still run it, but you cannot modify or remove it from this interface. To edit, locate the source file or add-in and open it directly.
- Excel blocks macros and shows a security warning: Go to File > Options > Trust Center > Trust Center Settings > Macro Settings. Choose "Enable all macros" (only for trusted files) or "Disable all macros with notification" and click "OK". Then reopen the file and click "Enable Content".
- Alt+F8 opens a different dialog: On some non-US keyboards, F8 may be mapped differently. Try pressing Alt+Fn+F8. If that doesn’t work, try using the Developer tab: go to Developer > Macros (if the tab is visible).
- Macro runs but produces an error: Open the macro in the Visual Basic Editor (via Alt+F8 > Edit) and check for syntax errors, undefined variables, or incorrect cell references. Use Debug > Step Into to trace execution line by line.