Skip to end of metadata
Go to start of metadata

Description

A Condition object represents a condition within a ConditionalFormat, a format that Excel will apply to a cell or group of cells if a specified condition is met.

C#
vb.net

Remarks

A ConditionalFormat object contains up to three Condition objects and a Range object representing the set of cells on which the conditions will be tested.

To create a Condition object, call one of the ConditionalFormat object's CreateCondition methods.

Examples

C#
vb.net

Properties

Name

Description

ComparisonType

Returns the Condition's Condition.Comparison value, which determines whether each cell value will be compared with one or two other values, or if a formula will be evaluated for each cell.

Formula1

If the comparison is between a cell value and two values, this is the minimum value; otherwise this is is the formula to be evaluated for the condition.

Formula2

If the value of Condition.ComparisonType is a comparison between a cell value and two values (e.g., Condition.Comparison.CellValueBetween), Formula2
sets or returns a formula whose result will be the maximum comparison value.

Style

Sets or returns the Style that will be set on conditionally formatted cells when the current Condition is met.

Methods

Name

Description

ApplyStyle(Style)

Applies the specified Style to the Condition's current Style.

ChangeCondition(Condition.Comparison, String)

Resets the current Condition's Comparison type and formula. The method takes one formulas, and therefore must take a Comparison that requires one formulas, such as Comparison.CellValueLessThan.

ChangeCondition(Condition.Comparison, String, String)

Resets the current Condition's Comparison type and minimum and maximum formulas. The method takes two formulas, and therefore must take a Comparison that requires two formulas, such as Comparison.CellValueBetween.

Nested Classes

Name

Description

Comparison

The value of Condition.Comparison determines whether the value of a conditionally formatted cell will be compared with one or two other values, or if a formula will be evaluated for each cell.
  • No labels