Standard Visual Basic Editor shortcut keys
As you work with the Visual Basic Editor, you might want to navigate the windows using keyboard shortcuts instead reaching for the mouse. These shortcuts 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). In some Windows configurations, it’s Ctrl+Shift+F10. |
Ctrl+R | Opens the Project Explorer. |
Ctrl+G | Opens the Immediate window. |
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 might 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 | Moves below the first line of the next procedure. |
Ctrl+up arrow | Moves below the first line of previous procedure. |
Ctrl+Page Down | Moves to the first line of the next procedure. |
Ctrl+Page Up | Moves to the first line of the previous procedure. |
Shift+F2 | Moves to the selected function or variable. |
Ctrl+Shift+F2 | Moves to the last position. |
Ctrl+Home | Moves to the beginning of a module. |
Ctrl+End | Moves to the end of a 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 the 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 might 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 project in the project list. |
End | Moves to the last visible item in the project list. |
Right arrow | Expands the selected folder. |
Left arrow | Collapses the selected folder. |
F7 | Opens the code pane for the selected file. |