Trang chủ‎ > ‎IT‎ > ‎Programming‎ > ‎VBA Visual Basic for Word, Excel‎ > ‎

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 PressWhat It Does
Alt+F11Toggles between the VBE and Excel windows.
Shift+F10Displays the active window’s shortcut menu (replicates right-clicking).
Ctrl+ROpens Project Explorer.
F4Opens the Properties window.
F2Opens Object Browser.
F1Opens VBA Help.
F7Activates 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 PressWhat It Does
Ctrl+down arrowSelects the next procedure.
Ctrl+up arrowSelects the previous procedure.
Ctrl+Page DownShifts one screen down.
Ctrl+Page UpShifts one screen up.
Shift+F2Goes to the selected function or variable.
Ctrl+Shift+F2Goes to the last position.
Ctrl+HomeGoes to the beginning of module.
Ctrl+EndGoes to the end of module.
Ctrl+right arrowMoves one word to the right.
Ctrl+left arrowMoves one word to the left.
EndMoves to the end of the line.
HomeMoves to the beginning of the line.
TabIndents the current line.
Shift+TabRemoves the indent for the current line.
Ctrl+JLists 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 PressWhat It Does
F5Runs the current procedure or continues after pausing.
Ctrl+BreakHalts the currently running procedure.
F8Goes into debug mode and executes one line at a time.
Ctrl+F8Executes code up until the cursor.
Shift+F8Steps over the current line while in debug mode.
F9Toggles a breakpoint for the currently selected line.
Ctrl+Shift+F9Clears all breakpoints.
Alt+D+LCompiles 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 PressWhat It Does
Up arrowMoves up the project list one item at a time.
Down arrowMoves down the project list one item at a time.
HomeMoves to the first file in the project list.
EndMoves to the last file in the project list.
Right arrowExpands the selected folder.
Left arrowCollapses the selected folder.
F7Opens the code window for the selected file.
Comments