Getting Started

Writing VBA code for Excel is easy and fun!!  Once you learn a few basics, you will be creating highly professional spreadsheets.  VBA allows you to design a spreadsheet that will do things that are impossible with the basic spreadsheet options.  It also allows you to make your spreadsheets more user-friendly.

The Visual Basic Toolbar

The first step in adding Visual Basic to your spreadsheet is to turn on the VB Toolbar.  To turn on the toolbar, select the View menu, click on the Toolbars command, and turn on the Visual Basic option.  The following toolbar will appear:

The options in the toolbar are as follows:

These buttons are used to record VB macros.
This option is used to establish the security settings for the VB code. VB macros can be used to write computer viruses.  The security settings are used to minimize danger from such viruses.
This tool displays the Visual Basic Editor.  This is where you write the Visual Basic code.
This tool displays the Control Toolbar.  This toolbar is used to add VB controls such as check boxes, combo boxes, and radio groups to a spreadsheet.
This tool is used to toggle the spreadsheet in and out of Design Mode.
This option brings up the spreadsheet (both the spreadsheet and any underlying VB code in the Microsoft Development Environment.  This editor allows you to edit the underlying spreadsheet code in an HTML format and develop powerful web applications.

Design Mode

When you are writing VB code and adding controls to a spreadsheet, there are two basic modes: Design mode and Run mode.  In design mode, when you click on a button or a control, you can edit the properties of the control in the VB Editor.  If you double click on a control, you can edit the code associated with the control.  If you are in Run mode, when you click on the control, the code associated with the control is executed.  When developing your spreadsheet, you will be moving in and out of Design mode.

The VB Editor

The VB Editor is where you edit the Visual Basic code.  It is very similar to the regular Visual Basic compiler.  The code is shown in a set of windows on the right.  The Project window on the left lists the components of the project.  The Microsoft Excel Objects folder lists each of the sheets in your spreadsheet and the workbook.  The Modules folder lists the code associated with Macros.