Where the heck did they stick this Visual Basic Editor that you’ve heard so much about? Actually, the Visual Basic Editor in Excel 2013 is always ready to step forward whenever you press Alt+F11 or click the Visual Basic command button on the Developer tab or press Alt+LV when this optional tab is displayed on the Ribbon.
The Developer tab is not one of the permanent tabs on the Excel Ribbon. If your Ribbon doesn’t have a Developer tab, this just means that you haven’t yet added it to the Ribbon, something you definitely want to do when working with macros.
To add the Developer tab, click the Developer check box in the Main Tabs list box on the Customize Ribbon tab of the Excel Options dialog box (Alt+FTC) to select it.
The figure shows the arrangement of the typical components in the Visual Basic Editor after you first open its window and open a new module sheet. As you can see, this window contains its own menu bar (with a few more menus than the regular Excel window uses).
Beneath the menu bar, you find a Visual Basic Editor Standard toolbar. This toolbar contains a number of buttons that you may use when creating and editing VBA code.
Beneath the Standard toolbar in the Visual Basic Editor, you find a number of tiled windows of various sizes and shapes. Keep in mind that these are the default windows. They aren’t the only windows that you can have open in the Visual Basic Editor (as though it weren’t crowded and confusing enough), nor is this the only way that they can be arranged.
The two most important windows (at least, when you’re first starting out using the Visual Basic Editor) are the Project Explorer window and the Code window. The Project Explorer window, which is located to the immediate left of the Code window, shows you all the projects that you have open in the Visual Basic Editor and enables you to easily navigate their various parts.
Note that in VBA, a project consists of all the code and user forms that belong to a particular workbook along with the sheets of the workbook itself.
The macros that you record in the workbook, as well as any that you write for it in the Visual Basic Editor, are recorded on module sheets to which generic names are assigned, such as Module1, Module2, and so forth.
The actual lines of VBA programming code for the macro that are stored on a particular module sheet appear in the Code window when you select its module in the Project Explorer window. (The Code window appears to the immediate right of the Project Explorer window.)
To open a module in the Code window, double-click its module icon in the Project Explorer or right-click the module icon and then choose View Code at the top of its shortcut menu.
If you want to rename a module in your VBA project to something a little more descriptive than Module1, Module2, and so on, you can do this in the Properties window that appears immediately below the Project Explorer. Simply click and drag through the name (such as Module1 or Module2) that appears after the label (Name) on the Alphabetic tab in the Properties window and replace it with a more descriptive name before you press Enter.
When renaming a module, remember that you must use the same naming guidelines as when naming a range name in a worksheet: Begin the module name with a letter of the alphabet and don’t put any spaces between words. (Use underlines instead.)
Did this glimpse into Excel programming leave you longing for more information and insight about Microsoft's popular spreadsheet program? You're free to test drive any of the For Dummies eLearning courses. Pick your course (you may be interested in more from Excel 2013), fill out a quick registration, and then give eLearning a spin with the Try It! button. You'll be right on course for more trusted know how: The full version's also available at Excel 2013.