VBA in Excel: Open the Editor with a Keyboard Shortcut

VBA & macros · Updated November 20, 2026

To open the VBA editor in Excel for Microsoft 365 on Windows, press Alt+F11. This opens the Visual Basic Editor (VBE), where you can view and edit a workbook’s VBA code; it does not run a macro. You’ll need the desktop version of Excel, because Excel for the web does not let you create, edit, or run VBA macros.

What You’ll Need

  • Excel for Windows desktop: The shortcut and ribbon directions below are for Microsoft 365 on Windows. Excel for Mac has a different key combination, described in the steps.
  • A workbook, if you want to inspect its code: Open the workbook first so its project appears in the editor. You can open the VBE without a workbook, but there will be no workbook project to browse.
  • Permission to use macros, if relevant: Your organization may restrict VBA or prevent you from changing macro settings. You do not need to enable macros just to open the editor.

Step-by-Step

  1. Open the workbook you want to work with. Start Excel for Windows and open the relevant file. If you have not created a workbook yet, you can start with a blank one. Opening the workbook first makes it easier to identify its VBA project once the editor appears. If the file came from someone else, only enable or run its macros if you trust the source and understand what they are meant to do.
  2. Press Alt+F11. Hold down the Alt key, press F11, and release both. Excel should bring the Visual Basic Editor to the foreground. On many keyboards this is a toggle: pressing Alt+F11 again returns you to Excel. The shortcut opens the editor; it does not start a macro or change the workbook by itself.
  3. Use the ribbon if the shortcut is inconvenient. In Excel, select Developer > Visual Basic. This opens the same editor as Alt+F11. If you do not see the Developer tab, use File > Options > Customize Ribbon, select the Developer check box in the list of main tabs, and choose OK. Then select Developer > Visual Basic. Enabling the tab only adds access to development tools; it does not enable or run macros.
  4. On a Mac, use the Mac shortcut or ribbon command. In Excel for Mac, press Option+F11 to open the VBA editor. Depending on your keyboard settings, you may also need to hold Fn while pressing F11. You can instead select Developer > Visual Basic. If Developer is missing, open Excel’s ribbon or toolbar preferences and enable the Developer tab; the exact preferences layout can vary by Excel for Mac release. The Windows File > Options path does not apply to Mac.
  5. Find the workbook in Project Explorer. In the VBE, look for the Project Explorer pane, usually on the left. It lists open VBA projects, commonly with names such as VBAProject (WorkbookName.xlsx). Select the project matching the workbook you opened. If the pane is hidden, choose View > Project Explorer in the VBE. The project can contain folders for Microsoft Excel Objects, Forms, and Modules.
  6. Open the code you need to inspect. Expand the project by selecting its plus sign or disclosure arrow. Double-click a sheet or ThisWorkbook under Microsoft Excel Objects to view code attached to that sheet or workbook. Expand Modules and double-click a module, such as Module1, to view a standard macro module. A blank or absent Modules folder does not mean the editor failed to open; the workbook may simply have no standard modules.
  7. Insert a module only if you intend to add code. To create a standard module, select the correct workbook project in Project Explorer, then choose Insert > Module in the VBE. A blank code pane will appear. Before adding or running VBA, save a copy of the workbook. Macro actions generally cannot be reversed with Ctrl+Z, so keep the original as a fallback. When you save a workbook containing VBA, use a macro-enabled format such as Excel Macro-Enabled Workbook (*.xlsm); saving as .xlsx removes VBA code.

Common Mistakes

  • Expecting the shortcut to run a macro. Alt+F11 opens the editor. To run a macro, return to Excel and use Developer > Macros, select the macro, and choose Run, or use another method deliberately assigned to that macro. Opening the editor is safe as a navigation action; running code is a separate choice.
  • Looking for code in the wrong place. A macro may be stored in a standard module, a worksheet object, ThisWorkbook, or another workbook such as Personal.xlsb. Expand the project tree and check the workbook name before editing. If several workbooks are open, do not assume the first project listed is the one you mean.
  • Assuming the Developer tab must be enabled for Alt+F11. The keyboard shortcut works without showing the tab. Enabling Developer is useful for ribbon access, but it is not required just to open the VBE.
  • Confusing macro security with editor access. A security warning about a workbook’s macros concerns whether its code can run. It does not necessarily mean the VBE is unavailable. Do not lower security protections just to view the editor or inspect a project.
  • Saving a VBA workbook as .xlsx. The standard .xlsx format does not preserve VBA macros. If you need to retain code, save a working copy as .xlsm and check the file type in the Save As dialog before confirming.

Tips

  • Use the shortcut as a quick toggle. Alt+F11 switches between Excel and the editor on Windows, which is handy when you need to check a sheet and then return to its code. If you are unsure which window has focus, look at the application title bar before typing or making changes.
  • Make the editor easier to navigate. In the VBE, choose View > Project Explorer if you cannot see the project list. The Properties window is available from View > Properties Window. These panes help identify which workbook, worksheet, or module you are viewing.
  • Keep the file type in mind from the beginning. If you plan to add VBA to a new workbook, save it as .xlsm before you finish. That reduces the chance of accepting a warning that code will be removed when saving in a non-macro format.
  • Use a copy for experiments. VBA can change cells, sheets, or files, and Ctrl+Z generally cannot undo macro actions. Save a separate copy before running unfamiliar code, and read through the macro before choosing Run. If the code came from another person, verify its source rather than relying only on its name or comments.
  • Remember the web limitation. Excel for the web can open many macro-enabled workbooks, but it cannot open the VBA editor or create, edit, or run VBA macros. To work with VBA, open the file in the desktop Excel application.

Troubleshooting

Alt+F11 does nothing: First confirm that the active application is Excel desktop, not Excel in a browser or another program. On a laptop, the function-key row may control brightness, volume, or other hardware features. Try Fn+Alt+F11, or use the Developer tab’s Visual Basic command. If the ribbon command works but the shortcut does not, the keyboard’s Fn behavior or a system-level shortcut may be taking priority.

The editor opens, but the workbook is not listed: Return to Excel, confirm the workbook is open, then press Alt+F11 again or select it in Project Explorer. If the pane is hidden, choose View > Project Explorer. A workbook with no code can still appear as a project; it may simply have no modules or procedures to display. If the workbook is protected or controlled by an organization, some project access may be restricted.

You cannot edit or run the VBA project: The project may be locked for viewing, the file may be read-only, or your organization may enforce restrictions. Check whether the workbook title indicates read-only status and whether you have permission to edit the file. Do not try to bypass a project password or workplace policy. Ask the file owner or administrator for access if needed.

You see a macro warning or a disabled Run option: Opening the editor is different from allowing code to run. If the file is trusted and you are authorized to use it, follow your organization’s approved process for opening it. Avoid enabling all macros globally. A disabled Run command can also mean no runnable procedure is selected, the cursor is not inside a macro, or the project is unavailable for editing.

You are using Excel for the web: There is no browser shortcut that opens the VBA editor. Choose the option to open the workbook in the desktop app, if available, then use Alt+F11 on Windows or Option+F11 on Mac. If you only have web access, you will need desktop Excel to edit or run VBA.

Frequently Asked Questions

What is the shortcut to open VBA in Excel?

In Excel for Windows, press Alt+F11. It opens the Visual Basic Editor. On a Mac, use Option+F11, sometimes with Fn as well depending on the keyboard’s function-key settings.

Does Alt+F11 work in every version of Excel?

It is the standard shortcut in the Windows desktop versions of Excel that include VBA. The web app does not provide the VBA editor. Some keyboard configurations intercept F11, so the Developer > Visual Basic command is a useful alternative.

How do I open the VBA editor without a keyboard shortcut?

In desktop Excel, choose Developer > Visual Basic. If Developer is not visible on Windows, enable it through File > Options > Customize Ribbon. On Mac, use the Developer tab if it is enabled in the ribbon preferences.

Does opening the VBA editor run the macros in my workbook?

No. Opening the VBE only displays the programming environment. A macro runs only when you start it through a command, assigned shortcut, event, or other trigger. Review unfamiliar code and save a copy before running it.

Why can’t I see any macros after opening the editor?

The workbook may not contain VBA, or its code may be stored in a different open workbook or project. Check Project Explorer and expand the relevant project. Also note that macros are not always listed as standard modules; worksheet and workbook event procedures appear under their respective objects.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.