Validation.Modify (Excel)

Modifies data validation for a range.

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

Modify (Type, AlertStyle, Operator, Formula1, Formula2)


Range("e5").Validation.Modify xlValidateList, xlValidAlertStop, xlBetween, "=$A$1:$A$10"

Arguments

Optional arguments

The following arguments are optional

Type (XlDVType) - An XlDVType value that represents the validation type.


Possible values are

xlValidateCustom Data is validated using an arbitrary formula.
xlValidateDate Date values.
xlValidateDecimal Numeric values.
xlValidateInputOnly Validate only when user changes the value.
xlValidateList Value must be present in a specified list.
xlValidateTextLength Length of text.
xlValidateTime Time values.
xlValidateWholeNumber Whole numeric values.

AlertStyle (XlDVAlertStyle) - An XlDVAlertStyle value that represents the validation alert style.

Possible return values are xlValidAlertInformation - Information icon, xlValidAlertStop - Stop icon, xlValidAlertWarning - Warning icon.

Operator (XlFormatConditionOperator) - An XlFormatConditionOperator value that represents the data validation operator.


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 - The first part of the data validation equation

Formula2 (XlFormatConditionOperator) - The second part of the data validation equation when Operator is xlBetween or xlNotBetween; otherwise, this 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.