Microsoft Office Tutorials and References
In Depth Information
Using Ranges
The following formula, for example, returns the string Sheet1 :
The Name property
The Name property returns a Name object for a cell or range. To get the actual cell or range
name, you need to access the Name property of the Name object. If the cell or range does not
have a name, the Name property returns an error.
The following Function procedure displays the name of a range or cell passed as its argument.
If the range or cell does not have a name, the function returns an empty string. Note the use of
On Error Resume Next . This handles situations in which the range does not have a name.
Function RANGENAME(rng)
On Error Resume Next
RANGENAME = rng.Name.Name
If Err.Number <> 0 Then RANGENAME = “”
End Function
The NumberFormat property
The NumberFormat property returns the number format (as a string) assigned to a cell or
range. The following function simply displays the number format for the upper-left cell in a range:
Function NUMBERFORMAT(cell)
NUMBERFORMAT = cell.Range(“A1”).NumberFormat
End Function
The Font property
The Font property returns a Font object for a range or cell. To actually do anything with this
Font object, you need to access its properties. For example, a Font object has properties such
as Bold , Italic , Name , Color , and so on. The following function returns TRUE if the upper-left
cell of its argument is formatted as bold:
Function ISBOLD(cell)
ISBOLD = cell.Range(“A1”).Font.Bold
End Function
Search JabSto ::

Custom Search