Databases Reference
In-Depth Information
FIGURE 4.13 Setting a second conditional formatting statement.
the possibility of such an occurrence, it would be desirable to color the font of a cell red and place
an outline around the cell if any cell in column C of this Worksheet does not contain a formula.
This can be done rather easily by adding a second condition of conditional formatting for the cells
in column C. However, to accomplish this, first a function must be created that will determine if
a cell does or does not contain a formula. The following simple function will return False if every
cell in the range passed to the function does not contain a formula.
Function FormulaInRange(Cells As Range) As Boolean
'Function will return True if cell or range of cells contains
a formula
FormulaInRange = Cells.HasFormula
End Function
Using this function, a second conditional formatting statement can be applied as shown in
Figure 4.13.
=
FormulaInRange(C2)
=
FALSE
(4.10)
When the FormulaInRange function returns False for a cell, its font will be set to bold red and an
outline will be placed around the cell as illustrated in Figure 4.13.
By using the format painter to apply this conditional formatting statement to all the cells utilized
in column C, any cell in column C that is inadvertently replaced with a static value instead of a
formula will stand out like a sore thumb by having its font turned bold red and being outlined as
shown in Figure 4.14.
FIGURE 4.14 Conditional formatting in action.
Search WWH ::




Custom Search