How to Open VBA in Excel: Find and Use the VBA Editor

VBA & macros · Updated November 21, 2026

To open the VBA editor in Excel for Microsoft 365 on Windows, open a workbook and press Alt+F11. You can also select Developer > Visual Basic on the ribbon. The editor lets you view, write, and organize Visual Basic for Applications code; it is separate from the worksheet grid. You do not need to enable macros just to open it. If the Developer tab is missing, you can turn it on in Excel’s ribbon settings.

What You’ll Need

  • The desktop version of Excel. Excel for the web can open and edit many workbook types, but it cannot open the VBA editor or create, run, or edit VBA macros.
  • A workbook, if you want to view code associated with a particular file. To explore the editor, you can also open a blank workbook.
  • Permission to use macros if you plan to run them. Your organization may restrict macros; opening the editor and running code are separate actions.

Step-by-Step

  1. Open Excel for desktop. Start Excel and open the workbook whose code you want to inspect, or create a blank workbook. If the file came from email or the internet, you can still open the editor, but Excel may block its macros for security. Do not enable code from an unknown source just to make the editor appear.
  2. Open the editor with the keyboard shortcut. Press Alt+F11 on Windows. The Visual Basic for Applications editor (VBE) should appear in a separate window. On some laptops, the function keys have extra hardware functions; if the shortcut changes screen brightness or does nothing, try Fn+Alt+F11. You can also use the ribbon method below.
  3. Use the ribbon if you prefer menus. In Excel, select the Developer tab, then choose Visual Basic in the Code group. This opens the same editor as the shortcut. If Developer is already visible, this is often the easiest route to remember because the button is clearly labeled.
  4. Show the Developer tab if it is missing. In Excel for Windows, choose File > Options > Customize Ribbon. In the list on the right, check Developer, then select OK. The tab should now appear on the ribbon. This setting changes which ribbon tab is displayed; it does not enable macros or change the security settings for code.
  5. Locate your workbook in the editor. In the VBE, look for the Project Explorer pane, usually on the left. It lists open workbooks as projects, often with names such as VBAProject (Book1) or VBAProject (SalesReport.xlsm). If the pane is hidden, press Ctrl+R or choose View > Project Explorer. Select the project that matches the workbook you intend to inspect.
  6. Expand the project tree. Select the plus sign beside the project name, or double-click the project, to show its folders. Common folders include Microsoft Excel Objects and Modules. The Excel Objects folder contains code attached to sheets and the workbook itself. A Modules folder, if present, usually contains standard code modules. Double-click an item to open its code window.
  7. Create a module if you need a place for new code. Select the correct workbook project in Project Explorer, then choose Insert > Module. Excel adds a standard module under that project and opens a blank code window. A module is a place to write general procedures; it does not automatically run simply because you created it. If you are only looking at existing code, you do not need to insert anything.
  8. Save in a format that keeps VBA code. If you add or change code, return to Excel and save the workbook as an Excel Macro-Enabled Workbook (.xlsm) using File > Save As, if it is not already in a macro-enabled format. A regular .xlsx file cannot store VBA code. If you save a workbook containing code as .xlsx, Excel warns that the VBA project will be removed if you continue with that format. Choose the macro-enabled format to retain it.

On a Mac: The Windows Alt+F11 shortcut does not apply. In Excel for Mac, open the Developer tab and select Visual Basic. If Developer is hidden, open Excel’s ribbon settings or preferences and enable the Developer tab in the ribbon customization options; the wording and location can differ slightly between Mac releases. Option+F11 may also open the editor, and some keyboards require Fn as well. Excel for the web does not provide the desktop VBA editor, so use the installed Windows or Mac app.

Common Mistakes

  • Looking for VBA in Excel for the web. The browser version does not include the VBE. Open the file in the desktop app instead; if you cannot install or access the desktop app, you will not be able to edit VBA there.
  • Assuming the Developer tab must be enabled for the shortcut. On Windows, Alt+F11 generally opens the editor even when Developer is hidden. Enabling the tab is an alternative way to access the command, not a requirement for the shortcut.
  • Confusing the editor with the macro security prompt. Opening the VBE does not mean Excel has enabled or run a workbook’s macros. Likewise, clicking “Enable Content” is not necessary just to inspect the editor. Only allow macros when you trust the file and understand why it needs them.
  • Saving code in an .xlsx file. This format does not preserve VBA projects. Save a code-containing workbook as .xlsm, or use another suitable macro-enabled Excel format where appropriate.
  • Adding code to the wrong project. If several workbooks are open, verify the project name before choosing Insert > Module. A module belongs to the selected workbook, and placing it in the wrong one can make the code seem to have disappeared when you close that file.

Tips

  • Keep the editor and workbook easy to identify. The VBE is a separate window. If it appears behind Excel, use the task switcher or select its window from the taskbar or Dock. Check the project name before editing, especially when several workbooks are open.
  • Use the built-in panes to navigate. In the VBE, Ctrl+R shows Project Explorer, and F4 shows the Properties window for a selected object. Ctrl+G opens the Immediate window, which is useful for inspecting or testing expressions. These shortcuts are for the Windows VBE; Mac keyboard behavior can differ.
  • Save a backup before running code. Make a copy of the workbook before you run an unfamiliar macro. VBA actions generally cannot be reversed with Excel’s Ctrl+Z Undo command, so a backup is the practical way to recover from unintended changes.
  • Do not change broad security settings to solve a shortcut problem. The Trust Center’s macro settings govern whether code can run; they are not a way to reveal the VBE. Avoid enabling all macros or changing protected settings unless you understand the security consequences and have a legitimate need.

Troubleshooting

Alt+F11 does nothing: First confirm you are in the desktop version of Excel rather than a browser tab. On a laptop, try holding Fn while pressing the shortcut. Check whether another application or a keyboard utility is intercepting the key combination. If the shortcut still fails, use Developer > Visual Basic. You can also restart Excel and try with a simple workbook open.

The Visual Basic button is missing: Enable Developer through File > Options > Customize Ribbon in Windows Excel, then check the Developer box and select OK. If you are on a Mac, look for the ribbon customization controls in Excel’s settings or preferences. If you use a work-managed installation and cannot change the ribbon, ask your administrator whether the feature is restricted.

The editor opens, but the project list is blank or hidden: Press Ctrl+R on Windows, or select View > Project Explorer. If no workbook project appears, return to Excel and confirm that a workbook is open, then switch back to the VBE. If the project tree is collapsed, expand the workbook entry using its plus sign. A workbook with no existing VBA may still appear as a project; it simply may not contain any modules yet.

You can see a project but cannot expand or edit it: The VBA project may be password-protected or locked by its author. You will need legitimate access from the workbook owner; do not try to bypass the protection. Some work or school policies also restrict access. Contact the file owner or your IT administrator if you need authorized access.

Excel warns that macros are blocked or disabled: That affects running the code, not opening the VBE. If you trust the workbook, follow your organization’s approved process or ask its administrator for guidance. Do not change macro settings globally just to view code. If you are editing a file, use a macro-enabled format so the VBA project is not discarded on save.

Frequently Asked Questions

What is the shortcut to open VBA in Excel?

In desktop Excel for Windows, press Alt+F11. On some laptops, you may need Fn+Alt+F11. On a Mac, use Developer > Visual Basic, or try Option+F11, adding Fn if required by the keyboard.

Can I open the VBA editor without enabling macros?

Yes. Opening the editor and allowing a workbook’s macros to run are separate actions. You can inspect code without enabling it. Only run macros from sources you trust.

Can I open VBA in Excel for the web?

No. Excel for the web does not include the VBA editor or support creating, editing, or running VBA macros. Open the workbook in the desktop version of Excel to work with its VBA project.

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

The Project Explorer may be hidden, or the selected workbook may not contain code. Show Project Explorer with Ctrl+R on Windows, expand the workbook project, and open its modules or sheet objects. If there are none, the workbook may simply have no VBA yet.

Do I need to save as .xlsm just to look at VBA?

No. You can open and inspect a project in a workbook without converting it. If you add or edit code and want to keep it, save as .xlsm; the .xlsx format cannot store VBA code.

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.