Skip to main content

FormatCondition.Modify method

Table of contents
  1. Syntax
  2. Parameters
  3. Example

Modifies an existing conditional format.

Syntax

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

expression A variable that represents a FormatCondition object.

Parameters

Name Required/Optional Data type Description
Type Required XlFormatConditionType Specifies whether the conditional format is based on a cell value or an expression.
Operator Optional Variant An XlFormatConditionOperator value that represents the conditional format operator. This parameter is ignored if Type is set to xlExpression.
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"

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>