FormatConditions.Add (Excel)
Adds a new conditional format.
Use the Modify method to modify an existing conditional format, or use the Delete method to delete an existing format before adding a new one.
Add (Type, Operator, Formula1, Formula2, String, TextOperator, DateOperator, ScopeType)
Dim fcd As FormatCondition
Set fcd = ActiveCell.FormatConditions.Add(Type:=xlAboveAverageCondition)
Arguments
The following argument is required
Type (XlFormatConditionType) - Specifies whether the conditional format is based on a cell value or an expression.
Here you can find possible values for
Optional arguments
The following arguments are optional
Operator (XlFormatConditionOperator) - The conditional format operator. Can be one of the following XlFormatConditionOperator constants: xlBetween, xlEqual, xlGreater, xlGreaterEqual, xlLess, xlLessEqual, xlNotBetween, or xlNotEqual. If Type is xlExpression, the Operator argument is ignored.
Possible values are
xlBetween | Between. Can be used only if two formulas are provided. |
xlEqual | Equal. |
xlGreater | Greater than. |
xlGreaterEqual | Greater than or equal to. |
xlLess | Less than. |
xlLessEqual | Less than or equal to. |
xlNotBetween | Not between. Can be used only if two formulas are provided. |
xlNotEqual | Not equal. |
Formula1 (String) - The value or expression associated with the conditional format. Can be a constant value, a string value, a cell reference, or a formula.
Formula2 - The value or expression associated with the second part of the conditional format when Operator is xlBetween or xlNotBetween (otherwise, this argument is ignored). Can be a constant value, a string value, a cell reference, or a formula
String - String
TextOperator
DateOperator
ScopeType