Categories
Excel

How to Open the VBA Editor in Excel (3 Ways)

VBA stands for Visual Basic for Applications. VBA is a programming language that is integrated into the core Microsoft Office applications like Excel, Outlook, PowerPoint, and Word.

I think Excel VBA is worth learning and anyone who wants to move beyond the basics in Microsoft Excel needs to understand how to create macros and automate complex tasks with VBA.

Writing code in the VBA editor gives developers more control and greater access to features in Excel. All VBA code is usually written in the Excel VBA editor.

What is the Visual Basic Editor in Excel?

The Visual Basic editor is Microsoft’s integrated development environment in Excel.

The Excel VBA editor is developers do two things:

  1. Customize code generated from macros in Excel.
  2. Write code to automate tasks and customize how Excel works.

The screenshot below shows the Visual Basic editor window.

Excel VBA editor

Visual Basic Editor Layout

When you open the Excel Visual Basic editor, you’ll notice that there are three main parts to the window:

  1. The Project Explorer contains a list of all open workbooks and their related source code objects.
  2. The Properties window displays all the properties for a selected object, which can be changed as needed.
  3. The Code window displays the VBA code associated with the selected code module in the Project Explorer.

The Excel VBA editor can be easily accessed, any time you need it.

3 Ways to Open the Excel VBA Editor

Now that you know what the Visual Basic editor is and you’ve seen the basic components that make up the VBA window, you probably want to know how to open it!

To open the Excel Visual Basic editor, click the Visual Basic button on the Developer tab in the Code group.

When the VBA editor appears, you’ll notice that the interface looks like it came out of an older version of Excel but don’t worry, you’ll be writing code in no time!

1) Use the Shortcut Key to View VBA Code in Excel

If you prefer to use shortcut keys for common tasks in Microsoft Excel, you’ll be pleased to know that you can open the visual basic editor by pressing Alt + F11.

2) Open the VBA Editor with the Visual Basic Button

If you’re not a fan of keyboard shortcuts, or Alt + F11 just isn’t working for some reason, just click the Visual Basic button on the Developer tab in the Code group.

The Developer tab isn’t enabled by default in Excel. To enable the Developer tab:

  1. Click the File tab and select Options.
  2. In the Excel Options dialog box, select the Customise Ribbon.
  3. Enable the checkbox beside Developer and click OK.

3) Open the VBA Editor by Right-Clicking a Worksheet Tab

Right-click any worksheet tab and select View Code from the shortcut menu.

How to Close the Excel VBA Editor

While opening the Visual Basic editor is pretty simple, closing it is just as easy.

When your VBA coding session is over, there are three ways to close the Visual Basic Editor:

  1. Click the File drop-down menu and select Close and Return to Microsoft Excel.
  2. Click the X upper-right corner of the Visual Basic editor.
  3. Press Alt + Q (to quit).

Final Thoughts on Working with Excel’s VBA Editor

I hope this article has helped you feel more comfortable with the Visual Basic editor window. It may look pretty complicated but once you start editing macros and working with actual code, you’ll see that it’s pretty easy to find your way around.

By Michael Belfry

Working as a full-time training consultant, Michael provides Microsoft Office courses to government and private sector clients across Canada.