Datasheet

Objects have methods. A method is an action Excel performs with
an object. For example, one of the methods for a Range object is
ClearContents. This method clears the contents of the range.
You specify a method by combining the object with the method,
separated by a dot. For example, the following statement clears the
contents of cell A1:
Worksheets(“Sheet1”).Range(“A1”).ClearContents
VBA includes all the constructs of modern programming languages,
including arrays and looping. In other words, if you’re willing to spend
a little time mastering the ropes, you can write code that does some
incredible things.
Believe it or not, the preceding list pretty much describes VBA in a nutshell.
Now you just have to find out the details. That’s the purpose of the rest of
this book.
An Excursion into Versions
If you plan to develop VBA macros, you should have some understanding
of Excel’s history. I know you weren’t expecting a history lesson when you
picked up this book, but bear with me. This is important stuff.
Here are all the major Excel for Windows versions that have seen the light of
day, along with a few words about how they handle macros:
Excel 2: The original version of Excel for Windows was called Version 2
(rather than 1) so that it would correspond to the Macintosh version.
Excel 2 first appeared in 1987 and nobody uses it anymore, so you can
pretty much forget that it ever existed.
Excel 3: Released in late 1990, this version features the XLM macro
language. Nobody uses this version either.
Excel 4: This version hit the streets in early 1992. It also uses the XLM
macro language. A small number of people still use this version. (They
subscribe to the philosophy if it ain’t broke, don’t fix it.)
Excel 5: This one came out in early 1994. It was the first version
to use VBA (but it also supports XLM). Excel 5 users are becoming
increasingly rare.
18
Part I: Introducing VBA
05_046746 ch01.qxp 1/12/07 6:16 PM Page 18