Microsoft Office Tutorials and References
In Depth Information
Function CELLFORMULA(cell)
CELLFORMULA = cell.Range(“A1”).Formula
End Function
You can use the HasFormula property to determine whether a cell has a formula.
The Address Property
The Address property returns the address of a range as a string. By default, it returns the address as an absolute
reference (for example, $A$1:$C$12). The following function, which is not all that useful, returns the address
of a range:
Function RANGEADDRESS(rng)
RANGEADDRESS = rng.Address
End Function
For example, the following formula returns the string $A$1:$C$3:
=RANGEADDRESS(A1:C3)
The formula below returns the address of a range named MyRange:
=RANGEADDRESS(MyRange)
The Count property
The Count property returns the number of cells in a range. The following function uses the Count property:
Function CELLCOUNT(rng)
CELLCOUNT = rng.Count
End Function
The following formula returns 9:
=CELLCOUNT(A1:C3)
The Count property of a Range object is not the same as the COUNT worksheet func-
tion. The Count property returns the number of cells in the range, including empty cells
and cells with any kind of data. The COUNT worksheet function returns the number of
cells in the range that contain numeric data.
Search JabSto ::




Custom Search