1. Home
  2. Computing & Technology
  3. Visual Basic
VBA - The Excel Working Partner
Using VBA with Microsoft Excel

Microsoft Excel Icon Excel is the Office application that is most frequently automated using VBA. In fact, Excel is where it all began. VBA was first implemented in Excel 5 in 1993. This probably happened for the same reason that the mainline accounting functions were the first to be automated using computers in the 1950's. Numbers and computers just go together. So there are a lot of really useful things you can do with Excel and VBA!

  Let's see what some of them are ...

As mentioned in the Introduction, this tutorial is based on Excel 2000 and VBA 6 because that's what most of our readers are using.


 More of this Feature
• Part 2: Record a Code Sample For Yourself
• Part 3: Learning From Your Code Sample
• Part 4: Customizing the Personal Workbook
 
 Join the Discussion
Do you use Excel VBA?
Tell us how !
 
 Related Resources
• Beginning Visual Basic
• Visual Basic 6
 
 From Other Guides
• About Business Software
 
 Elsewhere on the Web
• An Excel VBA book
From the great publisher, APress

• Excel Updates from Microsoft
(Browse to Office 2000)

 

Every Office application (in fact, every VBA hosting application) saves the VBA program in a slightly different way. The actual VBA program is normally saved as part of the hosting application's documents (this was demonstrated in the first segment by displaying the text contents of a VBA program inside a Word document).

To discover how Excel saves a VBA program, let's start with the same technique that we learned in the previous two segments: Tools > Macro > Record New Macro ... .

Record Macro Dialog

The resulting dialog has slightly different choices now, however. Excel gives you the choice of saving your VBA program in:

  • Personal Macro Workbook
  • New Workbook
  • This Workbook

The last two seem reasonably obvious. Excel's primary document is the Workbook and you have a choice of saving your program in the one you have open or a new one. The first option, Personal Macro Workbook, is a little more interesting.

When you click OK, you see that there's a new button on the Record New Macro Stop dialog. (Like most of Excel, this dialog can be customized so it's possible that your installation might be different.) In the code below, notice that the cell we're referencing is addressed using the absolute position "A2".

Relative Reference Select Button

If you click this button the Recorder will give you relative positioning (statements like ActiveCell.Offset(6, 3). ...).

Next page > Record a Code Sample For Yourself > Page 1, 2, 3, 4
Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic

©2009 About.com, a part of The New York Times Company.

All rights reserved.