363
Learning Tricks of the VBA Trade
Using Super-Variables: Object Variables
In typical programming languages, a variable holds a single value. You might use x = 4 to
assign a value of
4 to the variable x.
Many properties describe a single cell in Excel. A cell might contain a value such as
4, and
the cell also has a font size, a font color, a row, a column, possibly a formula, possibly a com-
ment, a list of precedents, and more. It is possible to use VBA to create a super-variable that
contains all the information about a cell or any other object. A statement to create a typical
variable such as
x = Range(“A1”) assigns the current value of cell A1 ...