Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

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.

Signature
C#
C#
 public void ChangeCondition(Comparison comparisonType, System.String formula1, System.String formula2)
{signature}{signature:
}
Signature
vb.net
vb.net
Public Sub ChangeCondition(ByVal comparisonType As Comparison, ByVal formula1 As String, ByVal formula2 As String)
{signature}
{parameters}
{param:comparisonType}The type of comparison Excel will use when comparing a cell value to {{formula1}} and {{formula2}}. The comparison type must require two formulas and may be set to one of the following values: {{Comparison.CellValueBetween}} or [Comparison.CellValueNotBetween|Condition.Comparison#CellValueNotBetween].{param}
{param:formula1}The formula to use for the minumum value.{param}
{param:formula2}The formula to use for the maximum value.{param}
{example}{code:csharp|title=C#}
Parameters
Param
comparisonType
comparisonType

The type of comparison Excel will use when comparing a cell value to formula1 and formula2. The comparison type must require two formulas and may be set to one of the following values: Comparison.CellValueBetween or Comparison.CellValueNotBetween.

Param
formula1
formula1

The formula to use for the minumum value.

Param
formula2
formula2

The formula to use for the maximum value.

Example
Code Block
csharp
csharp
titleC#


          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Create();
          ConditionalFormat condFmt = wb.CreateConditionalFormat();
          Condition cond =
               condFmt.CreateCondition(
               Condition.Comparison.CellValueGreaterThan,
               "=100");
          cond.ChangeCondition(
               Condition.Comparison.CellValueBetween,
               "=100",
               "=150");
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Create()
          Dim condFmt As ConditionalFormat = wb.CreateConditionalFormat()
          Dim cond As Condition = _
               condFmt.CreateCondition( _
               Condition.Comparison.CellValueGreaterThan, _
               "=100")
          cond.ChangeCondition( _
               Condition.Comparison.CellValueBetween, _
               "=100", _
               "=150")
        
{code} {example}