56 free macros indexedAll toolsHow to runBlogGitHub ↗

How to Open the VBA Editor in Excel

To open the VBA editor in Excel, press Alt + F11 on Windows. On Mac, use Developer > Visual Basic, because macOS often claims the F11 key.

2026-09-16

How to open the VBA editor in Excel

To open the VBA editor in Excel, press Alt + F11 on Windows. You can also click Visual Basic on the Developer tab, which does exactly the same thing. On Mac the menu route is the dependable one, because macOS often claims the F11 key for itself.

Opening it is the easy half. The window that appears has three panes and no obvious starting point, so this covers what you are actually looking at once you get there.

TL;DR: Key takeaways

  • Windows: Alt + F11, or Developer > Visual Basic.
  • Mac: use Developer > Visual Basic. The F11 shortcut is unreliable there.
  • The left pane is the Project Explorer. Your macros live under Modules.
  • Missing pane? View > Project Explorer brings it back.
  • Alt + F11 again returns you to the spreadsheet. The editor stays open.

Open it on Windows

Two routes, same result:

  • Press Alt + F11 from anywhere in Excel.
  • Or click Visual Basic in the Code group of the Developer tab.

The keyboard shortcut works whether or not the Developer tab is showing, so you do not need to enable the Developer tab just to see your code.

Open it on Mac

Use Developer > Visual Basic from the ribbon. Microsoft documents this route for both platforms, and on Mac it is the one to rely on.

The reason to prefer it is that macOS assigns F11 to a system function by default, so pressing Option + F11 in Excel may show your desktop instead of the editor. You can change that in macOS keyboard settings, but the menu route avoids the argument entirely.

What you are actually looking at

The editor is a separate application window, not a sheet. It has three parts that matter.

Project Explorer, top left. A tree of every open workbook. Expand one and you will find Modules, which is where recorded and imported macros live. Double-click a module to open its code.

Properties, bottom left. Attributes of whatever is selected in the tree. You will mostly use it to rename a module so it describes what the macros inside it do.

Code window, the large area on the right. This is the actual VBA. It stays blank until you double-click something in the Project Explorer, which is the step most people miss on their first visit.

If you are reading code rather than writing it, the VBA guide for non-coders explains what the common lines mean.

If a pane is missing

The editor remembers its layout, so a pane closed once stays closed. Nothing is broken.

Open the View menu and choose the pane you want. Microsoft points at this directly for the most common case: if the Project Explorer is not visible, go to View > Project Explorer. The editor's own help and shortcut reference covers the rest. The same menu restores the Properties and Immediate windows.

Running and testing code from the editor

You do not have to go back to Excel to run a macro.

  • F5 runs the macro your cursor is sitting in.
  • F8 steps through it one line at a time, which is the quickest way to see what a macro does before letting it loose on real data.

Both are worth knowing if you are editing a downloaded macro, since stepping through shows you exactly which cells it touches. Editing or deleting a macro covers changing the code itself, and importing a .bas file covers getting someone else's macro into the editor in the first place.

Frequently asked questions

What is the shortcut to open the VBA editor in Excel?

Alt + F11 on Windows, from anywhere in Excel. Pressing it again switches back to the worksheet without closing the editor. On Mac, use Developer > Visual Basic instead, since macOS usually intercepts the F11 key.

Why is Alt + F11 not working?

On Windows, the most common cause is a laptop keyboard where the function keys default to media controls, so you need Fn + Alt + F11. On Mac, macOS claims F11 for a system shortcut. The Developer tab's Visual Basic button always works on both.

Why is the VBA editor blank when I open it?

Because no module is selected yet. The code window stays empty until you double-click a module in the Project Explorer on the left. If the workbook has no macros at all, there will be no Modules folder to expand.

Do I need the Developer tab to open the VBA editor?

No. Alt + F11 works without it. The tab is only needed if you prefer a button, or if you want the other commands it carries, such as macro security settings and form controls.

Can I open the VBA editor in Excel for the web?

No. The browser version cannot create, run, or edit VBA macros, so there is no editor to open. You need desktop Excel on Windows or Mac.

What to do next

Open it once and look around before you need it in a hurry. Expand a workbook in the Project Explorer, double-click a module, and read the code. If there is nothing there yet, record a macro and reopen the editor to see what Excel wrote. Every macro in the free tools library also ships as readable source you can open in any text editor first.