Export (0) Print
Expand All

FormatConditions.Add Method 

Office 2003
Adds a new conditional format. Returns a FormatCondition object that represents the new conditional format.

Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)

'Usage
Dim Type As XlFormatConditionType
Dim Operator As Object
Dim Formula1 As Object
Dim Formula2 As Object
Dim returnValue As FormatCondition
Dim formatConditions1 As FormatConditions
returnValue = formatConditions1.Add(Type, Operator, Formula1, Formula2)

FormatCondition Add(
	[In] XlFormatConditionType Type, 
	[In, Optional] object Operator, 
	[In, Optional] object Formula1, 
	[In, Optional] object Formula2
);
public FormatCondition Add(
	/*in*/XlFormatConditionType Type, 
	/*in*/System.Object Operator, 
	/*in*/System.Object Formula1, 
	/*in*/System.Object Formula2
);
function Add(
	 Type : XlFormatConditionType, 
	 Operator : Object, 
	 Formula1 : Object, 
	 Formula2 : Object
) : FormatCondition;

Parameters

Type

Required XlFormatConditionType. Specifies whether the conditional format is based on a cell value or an expression. Can be one of the following XlFormatConditionType constants:

xlCellValue The conditional format is based on a cell value.

xlExpression The conditional format is based on an expression.

Operator

Optional 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

Optional 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

Optional 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.

You cannot define more than three conditional formats for a range. 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.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Community Additions

ADD
Show:
© 2015 Microsoft