This article is part of the Visual Tour of Excel’s Coding Dojo series, exploring each of the Excel VBA editor’s menus, toolbars, and windows. Here, we’ll take a close look at each VBA editor menu in Excel.
“I don’t want to hear the specials. If they’re so special, put ’em on the menu.”
Jerry Seinfeld
If you wish to skip to any of the other posts in the series, click on any of the topics listed below:
- How to Open the VBA Editor in Excel
- Exploring each VBA Editor Toolbar in Excel
- Getting Started with the Project Explorer
- Getting Started with the Properties Window
- Exploring the VBA Editor’s Code Window
- Exploring the VBA Editor’s Immediate Window
- Getting Started with the Locals Window
- Getting Started with the Watch Window
Meet your Mat! The VBA Editor
Most great martial artists first had to get intimate with their dojo. Likewise, to master Excel VBA, you’ll have to get comfy loitering in its coding dojo, the VBA Editor. Naturally, the first step is to open the VBA editor.
“The Dojo is the only place you can die and come back to life, so use it.”
kyoshi Larry Mabson (American karateka)
I, for one, know how daunting the Excel VBA editor can appear to beginners – just take a look at the overview below! However, looks can be deceiving; at least that’s true here. I say that because anyone familiar with programming IDEs will tell you that the VBA editor is one of the more user-friendly IDEs out there.
IDE stands for Integrated Development Environment. They are software that consolidates application development tools.
Most developers only use a few of the VBA Editor’s menus, toolbars, and windows. As a result, they miss out on several tools that would make their work less stressful and enhance their productivity.
But you are not most developers, are you? For one thing, you are here, so I take it you would like to max out your VBA programming potential. Brilliant! You are well on your way there.
Excel VBA Editor’s Menu Bar
The Excel VBA Editor Menu bar is a horizontal collection of drop-down menus. Its purpose is to provide quick access to most of the editor’s essential features. These menus are similar to the Ribbon menus in Excel or other Microsoft Office applications.
Menus and some of their items have keyboard shortcuts (a.k.a. accelerator keys or hotkeys) that simplify and quicken their use. To access each menu, you can either click its tab or press the keyboard shortcut, Alt + “first letter of the menu’s name.”
A birds-eye view of each menu in the VBA Editor Menu bar follows below. As you’ll see from the accompanying images, the purpose of most (if not all) the menu items (i.e., options in the dropdown of each menu) is evident from their names.
Excel VBA Editor’s File menu
This VBA editor menu allows you to perform file-related actions such as saving, importing and exporting, deleting, printing, and closing files.
Command | Description |
---|---|
Save Book1 | Saves the active workbook (or project) and all its forms and modules. You can also use the "Ctrl + S" keyboard shortcut to do this. |
Import File | Opens the Import File dialog box and allows you to include an existing module or form in your project. You can also use the "Ctrl + M" keyboard shortcut to do this. |
Export File | Opens the Export File dialog box and allows you to extract the active module or form to an external project. You can also use the "Ctrl + E" keyboard shortcut to do this. |
Remove Sheet1 | Should be used with great care as it permanently erases the active sheet, module or form. |
Opens the Print dialog box from which you can print the active module or form. You can also use the "Ctrl + P" keyboard shortcut to do this. | |
Close and Return to Microsoft Excel | Does precisely what its name implies. It hides the VBA editor while retaining its state (content and settings) in memory. |
Excel VBA Editor’s Edit menu
With this VBA editor menu, you can access several options related to making changes or retrieving changes to your work.
Command | Description |
---|---|
Undo | Restores the last action, however, Cut and Copy operations in the Code window can't be undone. You can also use either "Ctrl + Z" or "Alt + Backspace" keyboard shortcuts to do this. |
Redo | Restores your last action, and you can use it to retrieve your previous 20 actions. |
Cut | Copies the selected text to the clipboard while deleting it from its current location. You can also use either "Ctrl + X" or "Shift + Delete" keyboard shortcuts to do this. |
Copy | Clones the selected text to the clipboard while retaining it in its current location. You can also use either "Ctrl + C" or "Ctrl + Insert" keyboard shortcuts to do this. |
Paste | Implants the clipboard's content into the location you selected. You can also use either "Ctrl + V" or "Shift + Ins" keyboard shortcuts to do this. |
Clear | Removes the selected text. You can also use the "Del" key to do this. |
Select All | Selects the active Code window's entire contents or all the controls on a form. You can also use the "Ctrl + A" keyboard shortcut to do this. |
Find | Opens the Find dialog box and allows you to search for a specific text. You can also use the "Ctrl + F" keyboard shortcut to do this. |
Find Next | Opens the Find dialog box (if not already displayed) and allows you to search for the next occurrence of a specific text starting from a selected location in the active Code window. You can also use the "F3" key to do this. |
Replace | Opens the Replace dialog box and allows you to search for a specific text in the active Code window and replace it with another text. You can also use the "Ctrl + H" keyboard shortcut to do this. |
Indent and Outdent | Shifts a code line, or a block of code lines, to the next tab stop or the previous tab stop, respectively. You can also use the "Tab" key and the "Shift + Tab" keyboard shortcut to Indent and Outdent, respectively. |
List Properties/Methods | Shows the Tooltip IntelliSense listing the methods and properties of the object that has the cursor. You can also use either "Ctrl + J" or "Ctrl +Space" keyboard shortcuts to do this. |
List Constants | Shows the Tooltip Intellisense listing the built-in enumeration constants of the property or argument that has the cursor. You can also use the "Ctrl + Shift + J" keyboard shortcut to do this. |
Quick Info | Shows the Tooltip Intellisense displaying the format or template of the method/property that has the cursor. You can also use the "Ctrl + I" keyboard shortcut to do this. |
Parameter Info | Shows the Tooltip Intellisense which lists the arguments for the method having the cursor after the method's open bracket. You can also use the "Ctrl + Shift + I" keyboard shortcut to do this. |
Complete Word | Auto-completes words while you type, provided you have typed a sufficient number of words to allow the editor to predict the word you are typing correctly. You can also use the "Ctrl + Space" keyboard shortcut to do this. |
Bookmarks | Holds the commands for navigating and clearing bookmarks - i.e., Toggle Bookmark, Next Bookmark, Previous Bookmark, and Clear All Bookmarks. |
Excel VBA Editor’s View menu
As you would expect, this VBA editor menu grants you quick access to options for displaying several VBA editor windows.
Command | Description |
---|---|
Code | Opens the Code Window. You can also use either the "F7" key or the "Alt + V + C" keyboard shortcut to do this. |
Object | Shows the active item. You can also use either the "Shift + F7" or "Alt + V + B" keyboard shortcuts to do this. |
Definition | Reveals the position in the code where you have defined a variable, subroutine, or function. It would display the Object Browser if the variable, subroutine, or function were defined in a referenced library. You can also use either the "Shift + F2" or "Alt + V + D" keyboard shortcuts to do this. |
Last Position | Lets you swiftly navigate to any of the previous eight (8) cursor locations that you were at in your code. You can also use either the "Ctrl + Shift + F2" or "Alt + V + N" keyboard shortcuts to do this. |
Object Browser | Opens the Object Browser window if it is currently not visible. You can also use either the "F2" or "Alt + V + O" keyboard shortcuts to do this. |
Immediate Window | Displays the Immediate window if it is currently not visible. You can also use either the "Ctrl + G" or "Alt + V + I" keyboard shortcuts to do this. |
Locals Window | Shows the Locals window if it is currently not visible. You can also use the "Alt + V + S" keyboard shortcut to do this. |
Watch Window | Opens the Watches window if it is currently not visible. You can also use the "Alt + V + H" keyboard shortcut to do this. |
Call Stack | Displays the Call Stack dialog box when you are stepping through your code. So, it is only available when you are debugging your code. You can also use either the "Ctrl + L" or "Alt + V + K" keyboard shortcuts to do this. |
Project Explorer | Opens the Project Explorer window if it is currently not visible. You can also use either the "Ctrl + R" or "Alt + V + P" keyboard shortcuts to do this. |
Properties Window | Shows the Properties window if it is currently not visible. You can also use either the "F4" key or the "Alt + V + W" keyboard shortcut to do this. |
Toolbox | Opens the Toolbox floating window for the UserForm that you have selected prior. You can also use the "Alt + V + X" keyboard shortcut to do this. |
Tab Order | Shows the Tab Order dialog box for the UserForm that you have selected prior. The dialog box allows you to alter the order of activation of the UserForm's controls. You can also use the "Alt + V + A" keyboard shortcut to access this dialog box. |
Toolbars | Displays a sub-menu containing the checkboxes that toggle the display of the different VBA editor toolbars. You can also use the "Alt + V + T" keyboard shortcut to access this sub-menu. |
Microsoft Excel | Toggles the view between the Microsoft Excel application window and the VBA editor. You can also use the "Alt + F11" keyboard shortcut to do this. |
Excel VBA Editor’s Insert menu
This aptly named VBA editor menu grants you quick access to commands that let you add new items to your VBA project.
Command | Description |
---|---|
Procedure | Displays the Add Procedure dialog box, allowing you to add new subroutines, functions, or object properties to your VBA project's active module. You can also use the "Alt + I + P" keyboard shortcut to access this dialog box. |
UserForm | Adds a new UserForm to your VBA project. You can also use the "Alt + I + U" keyboard shortcut to do this. |
Module | Adds a new Standard module to your VBA project. You can also use the "Alt + I + M" keyboard shortcut to do this. |
Class Module | Adds a new Class module to your VBA project. You can also use the "Alt + I + C" keyboard shortcut to do this. |
File | Displays the Insert File dialog box, allowing you to add a text file's code/script to the VBA editor's Code window. You can also use the "Alt + I + L" keyboard shortcut to access this dialog box. |
Excel VBA Editor’s Format menu
This VBA editor menu contains commands related to UserForm visual design. It avails you several options for aligning, sizing, spacing, grouping, and ordering UserForm controls.
Command | Description |
---|---|
Align | Displays a submenu of commands for aligning multiple UserForm controls at once. The available options are Lefts, Centers, Rights, Tops, Middles, Bottoms, and To Grid. The format/alignment of the control you selected first is applied to all other controls in the selection. You can also access this submenu using the "Alt + O + A" keyboard shortcut. |
Make Same Size | Displays a submenu of commands for sizing multiple UserForm controls at once. The available options are Width, Height, and Both. The format/size of the control you selected first is applied to all other controls in the selection. You can also do this with the "Alt + O + M" keyboard shortcut. |
Size to Fit | Alters a selected UserForm control's height and width to fit its contents. You can also do this with the "Alt + O + T" keyboard shortcut. |
Size to Grid | Alters a selected UserForm control's height and width to fit the UserForm gridlines closest to it. You can also do this with the "Alt + O + D" keyboard shortcut. |
Horizontal Spacing | Displays a submenu of commands for adjusting the horizontal spacing between multiple UserForm controls at once. The available options are Make Equal, Increase, Decrease, and Remove. You can also do this with the "Alt + O + H" keyboard shortcut. |
Vertical Spacing | Displays a submenu of commands for adjusting the vertical spacing between multiple UserForm controls at once. The available options are Make Equal, Increase, Decrease, and Remove. You can also do this with the "Alt + O + V" keyboard shortcut. |
Center in Form | Displays a submenu of commands for centring one or more selected UserForm controls on a UserForm's central axes. The available options are Horizontally and Vertically. You can also do this with the "Alt + O + C" keyboard shortcut. |
Arrange Buttons | Displays a submenu for arranging one or more selected buttons (a type of UserForm control) along the bottom or edge of a UserForm. The available options are Bottom and Right. You can also do this with the "Alt + O + R" keyboard shortcut. |
Group | Organizes a selection of UserForm controls into a group that can then be formatted as a unit. You can also do this with the "Alt + O + G" keyboard shortcut. |
Ungroup | Dissolves a previously formed group of UserForm controls. You can also do this with the "Alt + O + U" keyboard shortcut. |
Order | Displays a submenu for altering the order of a selected UserForm control. The available options are Bring To Front, Send To Back, Bring Forward, and Send Backward. You can also do this with the "Alt + O + O" keyboard shortcut. |
Excel VBA Editor’s Run menu
This VBA editor menu avails you commands that relate to entering or leaving runtime, break mode, and design mode. It also lets you completely reset a VBA project.
Runtime is the period during which the compiler is running your VBA code.
Break Mode is a period when runtime is paused, and you are stepping through your code. You enter it when the compiler encounters an error in your code or you intentional “break” from runtime. You debug your code in break mode, and you can either return to runtime (using the Continue command) or exit to design mode (using the Design Mode command).
Design Mode is the period when the compiler isn’t running your code, and events from the Microsoft Excel or your VBA project will not execute. This period is either before you enter (using the Run command) or after you exit (using the Reset or Design Mode command) runtime. You write your code or design your userforms in design mode.
Command | Description |
---|---|
Run Sub/UserForm | Runs the active (i.e., having the cursor) procedure or userform. In break mode, this command becomes the Continue command. Moreover, this command becomes the Run Macro command if neither a procedure nor a userform is active. You can also use the "F5" key to invoke this command. |
Break | Pauses program execution, while exiting runtime and entering break mode. It allows you to step through your code, line by line, and make certain kinds of changes. You can also use either the "Ctrl + Break" or "Alt + R + K" keyboard shortcuts to invoke this command. |
Reset | Clears the Call stack and module-level variables. You can also use the "Alt + R + R" keyboard shortcut to invoke this command. |
Design Mode | Switches on design mode and becomes the Exit Design Mode command. |
Excel VBA Editor’s Debug menu
This VBA editor menu contains commands related to reviewing code execution and identifying errors – i.e., debugging.
Command | Description |
---|---|
Compile VBAProject | Compiles your project while identifying any syntax errors. You can also use the "Alt + D + L" keyboard shortcut to do this. |
Step Into | Runs your code one line or statement at a time. In design mode, it starts code execution and immediately switches to break mode before the first statement runs. Outside design mode, this command switches to break mode (if it wasn't already there) and runs only the current code line. You can also invoke this command using either the "F8" key or the "Alt + D + I" keyboard shortcut. |
Step Over | Executes the next code line in the current procedure, while in break mode, regardless of whether the current code line contains a Call statement to another procedure. If a Call statement exists in the current code line, invoking Step Into instead of Step Over executes the first statement in the called procedure. Using Step Over in this scenario runs the called procedure as a unit and shifts execution to the next code line in the current procedure. You can also invoke this command using either the "Shift + F8" or "Alt + D + O" keyboard shortcuts. |
Step Out | Executes all the code lines of a called procedure while in break mode, from the current to the last execution point in the called procedure. It displays the statement following the procedure call, once all remaining code lines in the called procedure have run. You can also invoke this command using either the "Ctrl + Shift + F8" or "Alt + D + U" keyboard shortcuts. |
Run to Cursor | Which is only available in design mode, executes all the code lines from the current statement to a statement of choice situated further down your code. The Margin Indicator icon, which appears in the Margin Indicator bar, identifies the current execution line. You can also invoke this command using either the "Ctrl + F8" or "Alt + D + R" keyboard shortcuts. |
Add Watch | Shows the Add Watch dialog box where you can add watch expressions to the Watches window. You can also invoke this command using the "Alt + D + A" keyboard shortcut. |
Edit Watch | Shows the Add Watch dialog box where you can alter or delete previously added watch expressions. You can also invoke this command using either the "Ctrl + W" or "Alt + D + E" keyboard shortcuts. |
Quick Watch | Shows the Quick Watch dialog box where you can view the current value of watch expressions of your choice. You can also invoke this command using either the "Shift + F9" or "Alt + D + Q" keyboard shortcuts. |
Toggle Breakpoint | Inserts or deletes a breakpoint at the current executable statement. You can also invoke this command using either the "F9" key or the "Alt + D + T" keyboard shortcut. |
Clear All Breakpoints | Deletes all the breakpoints in the active project. This command does nothing to breakpoints due to watch expressions or program errors found at runtime (e.g., when you have the Break on All Errors option selected). You can also invoke this command using either the "Ctrl + Shift + F9" or "Alt + D + C" keyboard shortcuts. |
Set Next Statement | Moves the execution point to a different statement within the same procedure. This code line can be above or below the currently selected statement in the procedure. Another way to do this is by dragging the Margin Indicator from the currently selected statement to the code line you would like to run next. You can also invoke this command using either the "Ctrl + F9" or "Alt + D + N" keyboard shortcuts. |
Show Next Statement | Highlights the code line queued to run next. You can also invoke this command using the "Alt + D + X" keyboard shortcut. |
Excel VBA Editor’s Tools menu
This VBA editor menu gives you access to several dialog boxes from which you can accomplish a host of specific tasks, from setting object references to adding digital signatures.
Command | Description |
---|---|
References | Opens the References dialog box from which you can set a reference to another application's object or type library. Doing so makes that other application's objects available to your code. You can also access this dialog box with the "Alt + T + R" keyboard shortcut. |
Additional Controls | Opens the Additional Controls dialog box from which you can add more controls or insertable objects to the Toolbox. You can also access this dialog box with the "Alt + T + A" keyboard shortcut. |
Macros | Opens the Macros dialog box from which you can run, edit, or delete a selected macro. You can also access this dialog box with the "Alt + T + M" keyboard shortcut. |
Options | Opens the Options dialog box from which you can access different tabs listing the VBA editor's attributes and customize them as desired. You can also access this dialog box with the "Alt + T + O" keyboard shortcut. |
VBAProject Properties | Opens the Project Properties dialog box from which you can set general and protection-related properties of your project. You can also access this dialog box with the "Alt + T + E" keyboard shortcut. |
Digital Signature | Opens the Digital Signature dialog box from which you can set the digital signature certificate for your project. You can also access this dialog box with the "Alt + T + D" keyboard shortcut. |
Excel VBA Editor’s Add-Ins menu
This VBA editor menu contains a single item, the Add-In Manager command. This command allows you to open or show the Add-In Manager dialog box, with which you can load and unload add-ins.
Add-Ins are programs you insert into Microsoft Excel to enhance its VBA editor capabilities. Note that you can also access the Add-In Manager dialog box with the “Alt + A + A” keyboard shortcut.
Excel VBA Editor’s Window menu
This VBA editor menu contains commands that deal with how you want to view the windows that you have opened.
Command | Description |
---|---|
Split | Horizontally divides the Code window (which must be the active window for this to work) into two halves, or recombines already split halves. You can also use the "Alt + W + P" keyboard shortcut to do this. |
Tile Horizontally | Arranges all your project's open document windows horizontally and without overlaps. You can also use the "Alt + W + H" keyboard shortcut to do this. |
Tile Vertically | Arranges all your project's open document windows vertically and without overlaps. You can also use the "Alt + W + V" keyboard shortcut to do this. |
Cascade | Piles all your project's open document windows in an overlapping and cascading manner. You can also use the "Alt + W + C" keyboard shortcut to do this. |
Arrange Icons | Positions the icons of any document windows that you have minimized, neatly at the bottom left of the window. You can also use the "Alt + W + A" keyboard shortcut to do this. |
Window List | Displays all your project's open document windows. |
Excel VBA Editor’s Help menu
This menu gives you access to resources that provide assistance with all aspects of Microsoft Excel and VBA.
Command | Description |
---|---|
Microsoft Visual Basic Help | Takes you to Microsoft Office Dev Center's Develop Solutions and Customize Excel page on your browser. There, you'll find helpful information on Excel application and Excel VBA programming. |
MSDN on the Web | Takes you to the Microsoft Developer Network (MSDN) home page. The MSDN homepage is "the home for Microsoft documentation for end-users, developers and IT professionals." |
About Microsoft Visual Basic | Opens the About Microsoft Visual Basic dialog box. This dialog box displays your Excel application's version number, copyright notice, and system information. |
The Long and Short of It
So, there you have it! The eleven built-in menus on Excel’s VBA editor menu bar – File, Edit, View, Insert, Format, Debug, Run, Tools, Add-Ins, Window, and Help. Each being a collection of commands to perform actions relating to their name.
Notably, you can use the View menu‘s Customize command to alter the make-up of these built-in menus. The Customize command, which you can find in the Toolbars submenu of the View menu, also lets you add commands to the VBA editor menu bar.
You can also check out the Office Dev Center page for more info on the VBA editor’s menus and commands.
As I mentioned earlier, this article is part of the Visual Tour of Excel’s Coding Dojo series exploring each of the Excel VBA Editor’s menus, toolbars, and windows. To check out any of the other posts in the series, click on topic links below:
- How to Open the VBA Editor in Excel
- Exploring each VBA Editor Toolbar in Excel
- Getting Started with the Project Explorer
- Getting Started with the Properties Window
- Exploring the VBA Editor’s Code Window
- Exploring the VBA Editor’s Immediate Window
- Getting Started with the Locals Window
- Getting Started with the Watch Window