Page 41 - Excel for Scientists and Engineers: Numerical Methods
P. 41
18 EXCEL: NUMERICAL METHODS
Some properties, such as Column or Count, are read-only. The Column
property of a Range object is the column number of the leftmost cell in the
specified range; it should be clear that this property can be read, but not changed.
The Count property of a Range object is the number of cells in the range; again,
it can be read, but not changed.
Properties can also modify properties. The following example
Range("Al").Font.Bold = True
makes the contents of cell A1 bold.
There is a large and confusing number of properties, a different list for each
object. For example, as of this writing (Excel 2003), the list of properties
pertaining to the Range object contains 93 entries:
Addlndent Font MergeArea Row
Address FormatConditions Mergecells RowHeight
AddressLocal Formula Name Rows
AllowEdit FormulaArray Next ShowDetail
Application FormulaHidden NumberFormat ShrinkToFit
Areas FormulaLabel NumberFormatLocal SmartTags
Borders FormulaLocal Offset SoundNote
Cells FormulaRlCl Orientation Style
Characters FormulaRlCl Local OutlineLevel Summary
Column HasArray PageBreak Text
Columns HasFormula Parent TOP
ColumnWidth Height Phonetic UseStandardHeight
Comment Hidden Phonetics UseStandardWidth
Count HorizontalAlignment Pivotcell Validation
Creator Hyperlinks PivotField Value
CurrentArray ID Pivotltem Value2
CurrentRegion I ndentLevel PivotTable VerticalAlignment
Dependents Interior Precedents Width
DirectDependents Item PrefixC haracter Worksheet
Directprecedents Left Previous WrapText
End ListHeaderRows QueryTable XPath
Entirecolumn Listobject Range
EntireRow LocationlnTable Reading Order
Errors Locked Resize
This large number of properties, just for the Range object, is what makes
VBA so difficult for the beginner. You must find out what properties are
associated with a particular object, and what you can do with them. For our
purposes (creating custom functions), only a limited number of these properties
of the Range object can be used. Some of the properties of the Range object
that can be used in a custom function are listed in Table 2-1. Note that, when
used in a custom function, these properties can only be read, not set.