Modify Method (FormatCondition Object)

Microsoft Excel Visual Basic

Modify Method (FormatCondition Object)

       

Modifies an existing conditional format.

expression.Modify(Type, Operator, Formula1, Formula2)

expression   Required. An expression that returns a FormatCondition object.

Type  Required XlFormatCondition.  Specifies whether the conditional format is based on a cell value or an expression.

XlFormatCondition can be one of these XlFormatCondition constants.
xlCellValue
xlExpression

Operator  Optional XlFormatConditionOperator.  The conditional format operator.

XlFormatConditionOperator can be one of these XlFormatConditionOperator constants.
xlBetween
xlEqual

xlGreater

xlGreaterEqual

xlLess

xlLessEqual

xlNotBetween

xlNotEqual

If Type, is xlExpression, the Operator argument is ignored.

Formula1   Optional Variant. The value or expression associated with the conditional format. Can be a constant value, a string value, a cell reference, or a formula.

Formula2   Optional Variant. The value or expression associated with the conditional format. Can be a constant value, a string value, a cell reference, or a formula..

Example

This example modifies an existing conditional format for cells E1:E10.

Worksheets(1).Range("e1:e10").FormatConditions(1) _
    .Modify xlCellValue, xlLess, "=$a$1"