Visual Basic in Excel

One of the best features of Visual Basic is that it is a powerful scripting language for writing macros and extensions to other programs including Excel, AutoCAD, and ArcView.  This tool is called Visual Basic for Applications (VBA).  This document gives a basic introduction on how to use VBA with Excel.

Contents

1. Getting Started

a. The Developer Tab

b. The Code Group

c. The Visual Basic Editor

d. The Controls Group

2. Recording Macros

3. Adding Controls to a Spreadsheet

a. The Controls Group

b. Creating Controls

c. Design Mode

4. Working with Cells and Ranges

a. The Range Object

b. The Cells object

c. Working with Multiple Cells

d. Looping Through Cells

5. Trapping for Worksheet Events

6. Creating Custom Functions

a. Format

b. Examples

c. Using Functions in VB

7. Calling Excel Worksheet Functions from VB Code

8. Custom Graphics

a. The Shape Object

b. The Shapes Collection

c. Creating Shapes

d. Modifying Properties of Shapes

e. Deleting Shapes

f. Coordinate Transformations

9. Getting Help

10. Sample VBA Applications

 

This primer was prepared by Norm Jones for CE En 270 at Brigham Young University.

Unauthorized use is strictly prohibited.