Databases Reference
In-Depth Information
Case "="
If CellValue = CompareValue Then CheckCondition = True
Case "<>"
If CellValue <> CompareValue Then CheckCondition = True
Case ">"
If CellValue > CompareValue Then CheckCondition = True
Case "<"
If CellValue < CompareValue Then CheckCondition = True
Case ">="
If CellValue >= CompareValue Then CheckCondition = True
Case "<="
If CellValue <= CompareValue Then CheckCondition = True
End Select
End Function
5.7
CREATING A COLOR FONT IF TOOL
It is just as likely that the user would want to be able to set the font color of a cell to a certain
color, provided the value in the cell met a certain condition or conditions. Because such an
application is similar to the “Highlight Cell If” sample application created in the previous section,
it only makes sense to reuse the form from the “Highlight Cell If” sample application. As shown
in Figure 5.18, there are some minor differences in the GUI created from the earlier application,
specifically that a checkbox has been added in the event that the user wants to turn the font bold,
and that the color preview pane shows a colored font as opposed to a colored background.
Figure 5.19 illustrates an example of where the font in Column A (Column 1) has been changed
to bold red when the value in a cell exceeds (>) the value in cell $A$1 (which is 1.603889). In
this instance, only one cell matches this criteria, cell $A$14, and its font has been changed to bold
red, whereas all the other cells' fonts remain unchanged.
Figure 5.20 illustrates an example of where the criteria is checked throughout the entire sheet.
In this example, a cell's font is changed to bold green if its value is less than the specified value
in the textbox in the GUI (1.01).
The only difference between this sample application and the previous sample application are
the properties that are set. Here the cell's font properties of color and boldface are set as opposed
to the cell's interior color and pattern properties. Thus, the lines in looping structure for the “Change
Font in Cells” button are changed to
FIGURE 5.18 The Color Font If GUI.
Search WWH ::




Custom Search