Cheat Sheet

Excel VBA Programming For Dummies Cheat Sheet

From Excel VBA Programming For Dummies, 5th Edition

By John Walkenbach

Excel shortcut keys allow you to perform certain tasks using only the keyboard. The idea being that you increase your efficiency when you limit the number of instances your hands have to move back and forth from the keyboard to the mouse. Getting in the habit of using these shortcut keys can help work more efficiently when using the Visual Basic Editor.

Standard Visual Basic Editor Shortcut Keys

As you work with Visual Basic Editor, you may want to navigate the windows using keyboard shortcuts instead reaching for the mouse. These short cuts allow you to navigate the Visual Basic Editor interface.

What to Press What It Does
Alt+F11 Toggles between the VBE and Excel windows.
Shift+F10 Displays the active window’s shortcut menu (replicates right-clicking).
Ctrl+R Opens Project Explorer.
F4 Opens the Properties window.
F2 Opens Object Browser.
F1 Opens VBA Help.
F7 Activates the open module window.

Shortcut Keys for Working in the Visual Basic Editor Code Window

At some point, you may find yourself working with many macros at one time. It can be tedious trying to navigate between and within macro procedures by clicking around with the mouse. These keyboard shortcuts allow you to quickly jump to a target procedure, navigate modules, and even find the starting point for variables.

What to Press What It Does
Ctrl+down arrow Selects the next procedure.
Ctrl+up arrow Selects the previous procedure.
Ctrl+Page Down Shifts one screen down.
Ctrl+Page Up Shifts one screen up.
Shift+F2 Goes to the selected function or variable.
Ctrl+Shift+F2 Goes to the last position.
Ctrl+Home Goes to the beginning of module.
Ctrl+End Goes to the end of module.
Ctrl+right arrow Moves one word to the right.
Ctrl+left arrow Moves one word to the left.
End Moves to the end of the line.
Home Moves to the beginning of the line.
Tab Indents the current line.
Shift+Tab Removes the indent for the current line.
Ctrl+J Lists the properties and methods for the selected object.

Shortcut Keys for Debugging Code in Visual Basic Editor

Debugging your code is an important part of working with Excel Macros. Although there are ways to use the debugging features through the Visual Basic Editor menu options, you may find these keyboard shortcuts to be a much more efficient way to debug your code.

What to Press What It Does
F5 Runs the current procedure or continues after pausing.
Ctrl+Break Halts the currently running procedure.
F8 Goes into debug mode and executes one line at a time.
Ctrl+F8 Executes code up until the cursor.
Shift+F8 Steps over the current line while in debug mode.
F9 Toggles a breakpoint for the currently selected line.
Ctrl+Shift+F9 Clears all breakpoints.
Alt+D+L Compiles the current Visual Basic project.

Shortcut Keys for Navigating the Visual Basic Editor Project Window

Want to navigate your visual basic projects without reaching for the mouse? Try using these keyboard shortcuts to move between projects and modules:

What to Press What It Does
Up arrow Moves up the project list one item at a time.
Down arrow Moves down the project list one item at a time.
Home Moves to the first file in the project list.
End Moves to the last file in the project list.
Right arrow Expands the selected folder.
Left arrow Collapses the selected folder.
F7 Opens the code window for the selected file.