Visual Basic Editor Components - dummies

Visual Basic Editor Components

By Michael Alexander

Visual Basic Editor is a separate application that runs when you open Excel. To see this hidden VBE environment, you’ll need to activate it. The quickest way to activate VBE is to press Alt+F11 when Excel is active. To return to Excel, press Alt+F11 again.

The figure shows the VBE program with some of the key parts identified. VBE contains several windows and is highly customizable, so chances are your window won’t look exactly like what you see in the figure. You can hide windows, rearrange windows, dock windows, and so on.

VBE with significant elements identified.
VBE with significant elements identified.

Menu bar

The VBE menu bar works just like every other menu bar you’ve encountered. It contains commands that you use to do things with the various components in VBE. Many menu commands have shortcut keys associated with them.

VBE also features shortcut menus. You can right-click almost anything in VBE and get a shortcut menu of common commands.


The standard toolbar, which is directly under the menu bar by default, is one of four VBE toolbars. You can customize the toolbars, move them around, display other toolbars, and so on. If you’re so inclined, use the View → Toolbars command to work with VBE toolbars. Most people just leave them as they are.

Project window

The project window displays a tree diagram that shows every workbook currently open in Excel (including add-ins and hidden workbooks). Double-click items to expand or contract them.

If the project window is not visible, press Ctrl+R or choose View → Project Explorer. To hide the project window, click the close button (the X) in its title bar. Alternatively, right-click anywhere in the project window and select Hide from the shortcut menu.

Code window

Every object in a project has an associated code window, which contains VBA code. To view an object’s code window, double-click the object in the project window. For example, to view the code window for the Sheet1 object, double-click Sheet1 in the project window. Unless you’ve added some VBA code, the code window will be empty.

Immediate window

The immediate window may or may not be visible. If it isn’t visible, press Ctrl+G or choose View→ Immediate Window. To close the Immediate window, click the close button (the X) in its title bar (or right-click anywhere in the Immediate window and select Hide from the shortcut menu).

The Immediate window is most useful for executing VBA statements directly and for debugging your code. If you’re just starting out with VBA, this window won’t be that useful, so feel free to hide it and free up some screen space for other things.