Hardware

37 keyboard shortcuts for moving faster in the Visual Basic Editor

If you spend a lot of time in the Office VBE, these keyboard shortcuts can make your work go more quickly.
The Visual Basic Editor (VBE) is the development environment in the Microsoft Office applications. Here are some handy keyboard shortcuts you can use to work more efficiently while entering, viewing, and editing code.

Note: This list is also available as a PDF download.

The shortcuts

General
Alt + F11 This toggles switch displays the VBE from the application window and vice versa.
Ctrl + G Displays the Immediate window.
Ctrl + F Opens the Find dialog box.
F3 Finds Next.
Shift + F3 Finds Previous.
Ctrl + H Opens the Replace dialog box.
Ctrl + Z Cancels the last keyboard stroke or the last mouse operation (when possible).
F5 Runs the current procedure or continues execution after pausing.
Ctrl + Break Halts a procedure.
Shift + F5 Terminates a procedure and resets all variables to their default values.
Shift + F10 Displays the active window's shortcut menu.
Ctrl + R Opens the Project Explorer.
F4 Opens the Properties window.
F2 Opens the Object Browser.
F1 Opens VBA Help.
F7 Gives focus to the open module window.
Code module
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.
Ctrl + Shift + F2 Goes to the last position.
Ctrl + Home Goes to the beginning of module. (Also in the Immediate window.)
Ctrl + End Goes to the end of module. (Also in the Immediate window.)
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.
Ctrl + Y Deletes the current line.
Ctrl + Delete Deletes to the end of a word.
Ctrl + Shift + F9 Clears all breakpoints.
Project Explorer
F7 Shift + Enter Opens the selected file's module.
Home Selects the first file in the list.
End Selects the last file in the list.
Right arrow Expands a sublist.
Left arrow Collapses a sublist.
Up arrow Moves up the list one item at a time.
Down arrow Moves down the list one item at a time.

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

5 comments
jswed
jswed

Also, in a Code Module: Shift-F2 - Goes to procedure referenced at insertion point

twistedg
twistedg

Throughout most of Office, Ctrl+Y is a great shortcut for Redo/Repeat. Yet not only does Redo/Repeat not exist in VB (to my knowledge), its shortcut is replaced with a destructive one. Grrr

bboyd
bboyd

remove pants or in vs 3.2 code like a pirate

ssharkins
ssharkins

I got the Print dialog box, which I also get with just Ctrl+p -- is this supposed to do something? I hope everyone will add combos that I haven't listed -- if we get enough, I'll post an updated table.

mw00110011
mw00110011

and the final character (P) is the related action. Any non-terminal keystrokes in between that have no programmed value may be ignored, until the "P" triggers the print dialog. Just a quess.

Editor's Picks