Microsoft Office Tutorials and References
In Depth Information
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
The EntireRow and EntireColumn properties
The EntireRow and EntireColumn properties enable you to work with an entire row or column for a particular
cell. The following function accepts a single cell argument and then uses the EntireColumn property to get a
range consisting of the cell's entire column. It then uses the Excel COUNTA function to return the number of
nonempty cells in the column.
Function NONEMPTYCELLSINCOLUMN(cell)
NONEMPTYCELLSINCOLUMN = WorksheetFunc-
tion.CountA(cell.EntireColumn)
End Function
You cannot use this function in a formula that's in the same column as the cell argument. Doing so will generate
a circular reference.
The Hidden property
The Hidden property is used with rows or columns. It returns TRUE if the row or column is hidden. If you try
to access this property for a range that does not consist of an entire row or column, you get an error. The follow-
ing function accepts a single cell argument and returns TRUE if either the cell's row or the cell's column is hid-
den:
Function CELLISHIDDEN(cell)
If cell.EntireRow.Hidden Or cell.EntireColumn.Hidden Then
CELLISHIDDEN = True
Else
CELLISHIDDEN = False
End If
End Function
You can also write this function without using an If-Then-Else construct. In the following function, the expres-
sion to the right of the equal sign returns either TRUE or FALSE — and this value is returned by the function:
Function CELLISHIDDEN(cell)
CELLISHIDDEN = cell.EntireRow.Hidden Or
cell.EntireColumn.Hidden
Search JabSto ::




Custom Search