You can use this rule to highlight data that meets one of the following conditions:
- is greater than a value
- is less than a value
- is between a high and low value
- is equal to a value
- contains a value
- is a date that occurs in a particular range
- is either unique or duplicated elsewhere in the worksheet
After you choose one of the options above, enter a value or formula against which each cell is compared. If the cell data satisfies that criteria, then the formatting is applied.
You can select a predefined highlight style or create a custom highlight style. The following rules are highlight style rules:
- BetweenValuesConditionalFormattingRule
- BlankConditionalFormattingRule
- ErrorConditionalFormattingRule
- FormulaConditionalFormattingRule
- TextConditionalFormattingRule
- TimePeriodConditionalFormattingRule
- UnaryComparisonConditionalFormattingRule
- UniqueOrDuplicatedConditionalFormattingRule
Using Code
Set the properties of the rule class and then apply the formatting.
Example
This example code creates the between values rule and uses the SetConditionalFormatting method to apply the rule.
C# | Copy Code |
---|---|
private void Form1_Load(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) |
VB | Copy Code |
---|---|
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click |
Using the Spread Designer
-
In the work area, select the cell or cells for which you want to set the conditional format.
-
Under the Home menu, select the Conditional Formatting icon in the Style section, then select the Highlight Cells Rules option, and then choose the condition.
-
From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.