VBA For Dummies Cheat Sheet - dummies
Cheat Sheet

VBA For Dummies Cheat Sheet

From VBA For Dummies, 5th Edition

By John Paul Mueller

VBA helps you get the upper hand with your computer but giving you the ability to dig into programming. To do this, you need to be familiar with VBA functions and data types, and some keyboard shortcuts can make your job even easier.

VBA Keyboard Shortcuts

If you’re using VBA to streamline your Windows programs and operations, making use of the shortcut keys in the following list can help you streamline even more quickly and easily.

Press To Do This Press To Do This
Alt+F11 Open the VBA editor F1 Get help on any selected item
Alt+F8 Display a list of macros F2 Display the Object Browser window
Ctrl+Break Perform an emergency stop of the program F4 Display the Properties window
Ctrl+G Display the Immediate window F5 Start the program
Ctrl+I List the quick information for the selected element F7 Display the Code window after selecting a form or control
Ctrl+J List the properties and methods for an object F9 Add a breakpoint
Ctrl+R Display Project Explorer Shift+F7 Display the form that corresponds to the active Code
Ctrl+Shift+I List the parameter information for the selected element Shift+F9 Add a quick watch for the highlighted text
Ctrl+Shift+J List the constants associated with an enumeration Ctrl+Tab Move to the next Code or UserForm window

Common VBA Functions

VBA helps you dig into your Windows programming. The VBA functions in the following list are ones used most often or that have proven to be quite helpful:

Use This Function To Do This
Asc, AscB, or AscW Convert a character into its ASCII, DBCS, or Unicode numeric
Chr, ChrB, or ChrW Convert a number into its ASCII, DBCS, or Unicode
CStr Convert any expression, including any supported data type, into
a string
CVErr Create a user-defined error number for your program
Format Change an enumeration or other expression into formatted
InputBox Get a single input from the program user
MsgBox Display a short message box onscreen
Str, Format, or CStr Convert a number into a string
Val, CByte, CCur, CDbl, CDec, CInt, CLng, or CSng Convert a string into a number

Standard VBA Data Types

VBA works with a variety of data types to help you make adjustments to Windows programs. The following table shows the standard VBA data types, how big they are and describes their functions: