Microsoft Excel

Visual Basic Editor

From Excel, type Alt+F11 or from the application menu, select Tools, Macro, Visual Basic Editor to open the Visual Basic Editor, as shown in Figure 1. The three main sections of the VBA Editor are described here. If this is your first time using VBA, some of these items may be disabled. Follow the instructions given in the following list to make sure that each is enabled:

  • Project Explorer This pane displays a hierarchical tree of all open workbooks. Expand the tree to see the worksheets and code modules present in the workbook. If the Project Explorer is not visible, enable it with Ctrl+R.

  • Properties window The Properties window is important when you begin to program user forms. It has some use when writing normal code, so enable it with F4.

  • Code window This is the area where you will write your code. Code is stored in one or more code modules attached to your workbook. To add a code module to a workbook, select Insert, Code Module from the application menu.

1. The Visual Basic Editor window is lurking behind every copy of Excel shipped since 1993.