Düzenle

Aracılığıyla paylaş


FormatConditions.Add Method

Definition

Adds a new conditional format.

public object Add (Microsoft.Office.Interop.Excel.XlFormatConditionType Type, object Operator, object Formula1, object Formula2, object String, object TextOperator, object DateOperator, object ScopeType);
Public Function Add (Type As XlFormatConditionType, Optional Operator As Object, Optional Formula1 As Object, Optional Formula2 As Object, Optional String As Object, Optional TextOperator As Object, Optional DateOperator As Object, Optional ScopeType As Object) As Object

Parameters

Type
XlFormatConditionType

. (XlFormatConditionType. Specifies whether the conditional format is based on a cell value or an expression.

Operator
Object

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.

Formula1
Object

The value or expression associated with the conditional format. Can be a constant value, a String value, a cell reference, or a formula.

Formula2
Object

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
Object
TextOperator
Object
DateOperator
Object
ScopeType
Object

Returns

A FormatCondition object that represents the new conditional format.

Remarks

You cannot define more than three conditional formats for a range. Use the Modify(XlFormatConditionType, Object, Object, Object) method to modify an existing conditional format, or use the Delete() method to delete an existing format before adding a new one.

Applies to