VBA Editor in Excel: Where to Find It and How to Open

VBA & macros · Updated November 3, 2026

VBA Editor in Excel: Where to Find It and How to Open

In Excel for Microsoft 365 on Windows, press Alt+F11 to open the Visual Basic Editor (VBE), where you can view and write VBA macros. You can also open it from Developer > Visual Basic; if the Developer tab is missing, enable it in Excel’s ribbon settings first.

Quick ways to open the VBA Editor

The Visual Basic Editor is a separate window that comes with the desktop version of Excel. It is not a worksheet or a panel inside the grid. The quickest way to open it on Windows is to use the keyboard shortcut:

  • Press Alt+F11. On some laptops, you may need to hold Fn as well, depending on how the function keys are configured.
  • Or choose Developer > Visual Basic on the Excel ribbon.
  • To return to Excel, switch windows or press Alt+F11 again.

The shortcut opens the editor whether or not the current workbook contains macros. Opening the VBE does not run a macro, change the workbook, or require you to enable macros. If the editor opens behind Excel, check the taskbar or use Alt+Tab to switch to it.

Show the Developer tab in Excel

The Developer tab is commonly hidden by default, but you can add it without installing anything. In Excel for Microsoft 365 on Windows, use these steps:

  1. Choose File > Options.
  2. Select Customize Ribbon.
  3. Under Main Tabs on the right, check Developer.
  4. Select OK. Developer should now appear on the ribbon.

Then choose Developer > Visual Basic to open the editor. The same tab also contains commands for recording and running macros, so it is useful if you work with VBA regularly. You can leave it visible; showing the tab does not make macros run automatically or lower workbook security.

On a Mac, enable the tab through Excel > Settings or Preferences > Ribbon & Toolbar, then select Developer in the list of tabs. The exact wording can vary by Excel release. You can also look for Visual Basic under Tools > Macro, or use Option+F11. Depending on the keyboard and macOS settings, you may need Fn+Option+F11.

What you see when the editor opens

The VBE displays VBA projects, code windows, and tools for editing or debugging macros. A project usually represents an open workbook or an add-in. Its contents can include worksheet objects, the ThisWorkbook object, standard modules, class modules, and forms. Those components are where different kinds of VBA code are stored.

  • Project Explorer: Lists open VBA projects and their components. In the Windows editor, Ctrl+R shows or hides it.
  • Code window: Displays the code for a selected module, worksheet, or workbook object. Press F7 in the editor to show a code window for the selected item.
  • Properties window: Shows editable properties for the selected component. Press F4 to show or hide it.
  • Immediate window: A space for entering or checking VBA statements during debugging. It can be shown from the View menu.

If the main area looks empty, the project may simply be collapsed. In Project Explorer, expand the project for the workbook you want, then open a component such as a module or a worksheet. A workbook with no existing VBA may not have a Modules folder yet; you can create a standard module using Insert > Module.

Find code in a particular workbook

When several workbooks are open, the VBE may list several projects. Look for the project whose name matches the workbook you want to inspect. A workbook’s code is not necessarily stored in a standard module: event procedures can belong to a specific worksheet or to ThisWorkbook. For instance, code that responds to a worksheet change is commonly placed in that worksheet’s code window.

To inspect an existing macro, expand the relevant project and open its modules. If you know the macro name, you can also return to Excel and use Developer > Macros to see eligible macros in the current workbook. That dialog is for choosing macros to run, not for browsing every line of code. The VBE is the place to inspect and edit the code itself.

To add a small test macro, first save a copy of the workbook. Running VBA can make changes that Ctrl+Z cannot undo, so a separate copy gives you a way back if code does something unexpected. In the VBE, select the target workbook’s project and choose Insert > Module. A simple example is:

Sub ShowWelcomeMessage()
    ' Display a simple confirmation message.
    MsgBox "VBA is available in this workbook."
End Sub

Click inside the procedure and press F5 to run it, or return to Excel and select it through Developer > Macros. This example only displays a message. It does not demonstrate that every macro is safe: inspect unfamiliar code before running it.

Excel for Windows, Mac, and the web

The steps above primarily describe Excel for Microsoft 365 on Windows. Excel for Mac includes a Visual Basic Editor, and the Developer tab and Tools > Macro menu can provide access to it. The keyboard shortcut is generally Option+F11, sometimes with Fn. Some VBA features and integrations are Windows-specific or behave differently on Mac, so a macro that works on one platform may need changes on the other.

Excel for the web does not provide the desktop Visual Basic Editor and cannot create, edit, or run VBA macros. To work with VBA, open the workbook in the desktop Excel app. A web browser may still let you view or edit ordinary workbook content, but it is not a substitute for the VBE. If you need browser-based automation, Office Scripts is a separate feature; it uses a different scripting model and is not VBA.

Workbook formats and saving VBA code

A standard .xlsx workbook cannot store VBA project code. If you add a macro to a workbook and want to keep it, save the file in a macro-capable format, usually Excel Macro-Enabled Workbook (.xlsm), using File > Save As. Excel may warn that a feature cannot be saved in a macro-free workbook if you try to keep VBA in an .xlsx file. Follow the prompt carefully and choose a format that preserves the code.

Other formats can also contain VBA, including Excel Binary Workbook (.xlsb). The Personal Macro Workbook, usually named PERSONAL.XLSB, is a separate hidden workbook intended for macros you want available across Excel workbooks on that computer. It is not the same as saving a macro inside the file you are sharing. Before sending a macro-enabled file, consider whether the recipient needs the code and explain what it does.

Why the editor may not open

If Alt+F11 does nothing, first try Developer > Visual Basic. This helps determine whether the issue is the shortcut, a laptop function-key setting, or access to the editor. Also check that you are using the desktop Excel application rather than Excel for the web. If a company manages your computer, its policies may restrict VBA or access to related features.

  • Developer is missing: Enable it through File > Options > Customize Ribbon on Windows, or Ribbon & Toolbar settings on Mac.
  • The shortcut behaves differently: Try the ribbon command, and check whether Fn is needed on your keyboard. On Mac, try Option+F11 or Fn+Option+F11.
  • The project is not visible: Open Project Explorer with Ctrl+R on Windows, then expand the workbook project.
  • Code is unavailable or blocked: The file may not contain VBA, may be in a format that cannot retain it, or may be subject to security or organization settings.

Macro security settings control whether VBA code is allowed to run; they are distinct from opening the editor. On Windows, review them at File > Options > Trust Center > Trust Center Settings > Macro Settings. Do not enable all macros just to view the VBE. On Mac, macro-security options are available through Excel’s Preferences or Settings, with wording that can differ by version. Follow your organization’s guidance if the settings are managed.

VBA macros and alternatives

VBA is useful for automating repeated desktop Excel tasks, responding to workbook or worksheet events, and adding custom procedures to a workbook. For example, a macro might format a report with the same steps each month. The VBE lets you write and debug that code, but it does not turn a macro into a worksheet formula: VBA procedures run as code, and their results may depend on workbook structure and Excel settings.

If you only need to record straightforward actions, Excel’s Macro Recorder may be a starting point; find it on the Developer tab. The recorder produces VBA that you can inspect and adjust in the VBE, though recorded code can be less flexible than code written for the task. For automation that must run in Excel for the web, consider Office Scripts where available. Use the option that fits the environment: VBA for compatible desktop workflows, Office Scripts for supported web-based workflows, or built-in Excel features when a formula or command is sufficient.

Frequently Asked Questions

Is the VBA Editor built into Excel?
Yes. The Visual Basic Editor is included with desktop Excel. You can open it with Alt+F11 on Windows or through Developer > Visual Basic. Excel for the web does not include the VBE.

Do I need to enable macros just to open the VBA Editor?
No. You can open the editor and inspect code without enabling macros. Macro-security settings affect whether VBA can run, not whether you can open the VBE.

Why can’t I see the Developer tab?
It is hidden by default in many installations. Enable Developer under File > Options > Customize Ribbon on Windows, or through Ribbon & Toolbar settings on Mac.

Can I edit VBA in Excel Online?
No. Excel for the web cannot create, edit, or run VBA. Open the workbook in desktop Excel to use the Visual Basic Editor.

How do I keep a macro when I save the workbook?
Save the workbook as an .xlsm file, or another format that supports VBA, such as .xlsb. Saving as .xlsx does not preserve 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.