編輯

共用方式為


Validation.Modify(Object, Object, Object, Object, Object) Method

Definition

Modifies data validation for a range.

public void Modify (object Type, object AlertStyle, object Operator, object Formula1, object Formula2);
Public Sub Modify (Optional Type As Object, Optional AlertStyle As Object, Optional Operator As Object, Optional Formula1 As Object, Optional Formula2 As Object)

Parameters

Type
Object

Required XlDVType. The validation type.

AlertStyle
Object

Optional XlDVAlertStyle. The validation alert style.

Operator
Object

Optional XlFormatConditionOperator. The data validation operator.

Formula1
Object

Optional Object. The first part of the data validation equation.

Formula2
Object

Optional Object. The second part of the data validation when Operator is xlBetween or xlNotBetween (otherwise, this argument is ignored).

Remarks

The Modify method requires different arguments, depending on the validation type, as shown in the following table.

xlInputOnly AlertStyle, Formula1, and Formula2 are not used.
xlValidateCustom Formula1 is required; Formula2 is ignored. Formula1 must contain an expression that evaluates to True when data entry is valid and False when data entry is invalid.
xlValidateList Formula1 is required; Formula2 is ignored. Formula1 must contain either a comma-delimited list of values or a worksheet reference to the list.
xlValidateDate, xlValidateDecimal, xlValidateTextLength, xlValidateTime, or xlValidateWholeNumber Formula1 or Formula2, or both, must be specified.

Applies to