Visual Basic

How To Open Visual Basic Editor In Excel

To open the Visual Basic Editor in Excel for Windows, press Alt + F11, or select Developer > Visual Basic on the ribbon. If Developer is hidden, enable it through File > Options > Customize Ribbon. On a Mac, use Developer > Visual Basic or.

Which licences fit your PC setup?

Prices are an AUD snapshot, not a live quote. Confirm variant and total on the listing.

Open the editor through the Developer tab in Windows

The Visual Basic Editor, often called the VBE, is where you write, inspect and debug Visual Basic for Applications (VBA) code. It opens in a separate window from your worksheet. You can open it in a blank workbook; an existing macro is not required.

If the Developer tab is already visible, select it and click Visual Basic in the Code group. Otherwise, follow these steps to display it:

  1. Open Excel and select File > Options.
  2. Choose Customize Ribbon.
  3. In the list on the right, select Main Tabs if it is not already selected.
  4. Tick Developer, then select OK.
  5. On the ribbon, select Developer > Visual Basic.

This is the ribbon setup described in Microsoft's Developer tab instructions. Showing the tab gives you access to the commands; it does not automatically run macros.

Use a shortcut or open a particular macro

Open the editor with Alt + F11

With the Excel desktop window active in Windows, press Alt + F11. This works even when the Developer tab is hidden. If your keyboard uses F11 for volume, brightness or another hardware function, you may need to hold Fn as well.

Microsoft lists the Windows and Mac commands in its Excel keyboard shortcut reference. If a shortcut is intercepted by your keyboard or operating system, use the ribbon command instead.

Go directly to an existing macro

Use the Macros dialogue when you know which macro you want to inspect:

  1. In Windows, press Alt + F8, or select Developer > Macros.
  2. Select the macro from the list. Check the Macros in list if it belongs to a different open workbook.
  3. Select Edit to open its code in the Visual Basic Editor.

Alt + F8 opens the macro list, while Alt + F11 opens the editor directly. The macro list is not a complete inventory of VBA code: worksheet events, functions and procedures requiring arguments may not appear there.

Open the Visual Basic Editor on a Mac

In Excel for Mac, select Developer > Visual Basic. If the tab is missing, enable it first:

  1. Choose Excel > Preferences > Ribbon & Toolbar.
  2. Under Customize the Ribbon, select Main Tabs.
  3. Tick Developer and select Save.
  4. Return to the ribbon and select Developer > Visual Basic.

These ribbon settings are covered in Microsoft's guide to using the Developer tab on Mac. You can also press Option + F11; depending on your keyboard settings, you may need Fn + Option + F11.

Find the correct workbook and code window

Opening the editor does not necessarily display the code you need. A blank editing area can simply mean that no module is open yet.

  1. In the editor, choose View > Project Explorer if the project list is hidden.
  2. Find VBAProject followed by your workbook's filename. Check the name carefully if several workbooks are open.
  3. Expand the project. Open the Modules folder and double-click a module to view ordinary macro code.
  4. For worksheet or workbook event code, expand Microsoft Excel Objects and double-click the relevant sheet or ThisWorkbook.

The Project Explorer documentation explains how to select project components and display their code. For a new general-purpose macro, select your workbook's project and choose Insert > Module. This creates a standard module where you can write the procedure.

For sheet-specific code in Windows, you can also right-click the worksheet tab in Excel and select View Code. That opens the sheet's code module, which is useful for events such as a cell value changing.

Save VBA code in a suitable workbook format

If you add code to an ordinary workbook, use File > Save As and choose Excel Macro-Enabled Workbook (*.xlsm). An .xlsx file cannot retain VBA code. Keep a separate copy before editing an important workbook's existing macros.

To return to the worksheet, switch back to the Excel window. Closing the editor window does not close the workbook. Opening or inspecting code also does not mean you have run it.

Resolve common access problems

You are using Excel in a browser

Excel for the web cannot create, run or edit VBA macros. Open the workbook in the desktop app to use the editor. Microsoft confirms this limitation in its guidance on VBA in Excel for the web.

Macros are blocked or the project is locked

You do not need to enable all macros merely to open the editor. Macro security controls whether code can run. The separate Trust access to the VBA project object model setting controls programmatic access to VBA projects, rather than ordinary manual editing, as explained in Microsoft's macro security guidance.

If a project asks for a password, obtain it from the workbook owner. If Visual Basic is unavailable on a managed work computer, ask your IT team to check the installation and organisational restrictions.

Choose a first VBA task

Start with a small task, such as formatting a selected range or inspecting a recorded macro. The Visual Basic guides offer further topics. For broader form-programming concepts, see coding a clear button and coding a checkbox in Visual Basic. Check the environment before adapting examples: Visual Basic application code and Excel VBA can use different controls and syntax.

Open a practice workbook now, launch the editor and locate that workbook in Project Explorer before making your first change.

Other editions for separate workloads

Other editions for separate workloads; prices in AUD, confirm the total on the listing.

How to check this worked

  1. Open Settings, System, Activation and confirm the edition shown.
  2. Enter the key and run activation; expect a green tick within a minute.
  3. Reboot and re-check activation survives the restart.

FAQ

What else should you know before buying?

What do I need before starting?
Read the requirements and confirm the edition first; the steps assume the machine is compatible.
How do I know the licence is genuine?
Activate on Microsoft's servers and check Settings, System, Activation. A working activation is the test.
Is this a subscription?
Keys sold here are one-time lifetime licences. Microsoft 365 plans are billed by Microsoft instead.
What if the key fails?
Email hi@ms.codes with the order number and a screenshot. Replacement or refund applies within 30 days.

Check who prepared and reviewed this guide

Written by
MS.Codes editorial
Reviewed by
Support team

Last verified: (source review; see test status above).

Recent Post