Microsoft Office Tutorials and References
In Depth Information
How To Get Into the VBE
HoW To gET inTo THE VBE
With Excel open, a fast and easy way to get into the Visual Basic Editor
is to press Alt+F11 on your keyboard. You can do this from any
worksheet. It’s just as quick with your mouse too, by clicking the Visual Basic
Editor icon on the Visual Basic toolbar in versions up to 2003, as shown
in Figure 3-1, or the Visual Basic button from the Developer tab on the
Ribbon in later versions, as shown in Figure 3-2.
cArEful, THAT WAs *AlT*+f11!
The Ctrl key is commonly used in conjunction with other keys for keyboard
shortcuts. By force of habit, you might mistakenly press Ctrl+F11 instead of Alt+F11
when attempting to go to the VBE. However, pressing Ctrl+F11 has a curious result:
you won’t be taken to the VBE, but instead you will have created and find yourself
on an outdated type of sheet called a macro sheet, with the strange tab name of
Macro1. Prior to Excel version 97, macros were stored on macro sheets, which can
still be created, though they have no practical use with today’s Excel, and they no
longer hold any programming code. It’s OK to just delete the macro sheet if you
create one, and take another stab at the Alt key with F11 to get into the VBE.
undErsTAnding THE VBE
The Visual Basic Editor can show a number of different windows depending on what you want to
see or do. For the majority of work you’ll be doing with the help of this topic, you’ll want to
eventually become familiar with four windows: the Project Explorer window, the Code window, the
Properties window, and the Immediate window. Figure 3-3 shows what the VBE looks like with
these four windows.