Microsoft Office Tutorials and References
In Depth Information
Figure 19-20: Using a custom VBA function to apply conditional formatting to cells that contain a formula.
Identifying date cells
Excel lacks a function to determine whether a cell contains a date. The following VBA function, which uses the
VBA IsDate function, overcomes this limitation. The custom CELLHASDATE function returns TRUE if the
cell contains a date.
Function CELLHASDATE(cell) As Boolean
CELLHASDATE = IsDate(cell)
End Function
The following conditional formatting formula applies formatting to cell A1 if it contains a date and the month is
June:
=AND(CELLHASDATE(A1),MONTH(A1)=6)
Search JabSto ::




Custom Search