Class Validation (Excel VBA)

The class Validation represents data validation for a worksheet range.

Class Range gives access to class Validation.


Dim vld as Validation
Set vld = ActiveCell.Validation

Methods

Add - Adds data validation to the specified range.

Delete - Deletes the object.

Modify - Modifies data validation for a range.

Properties

AlertStyle returns the validation alert style.

ErrorMessage returns or sets the data validation error message.

ErrorTitle returns or sets the title of the data-validation error dialog box.

Formula1 returns the value or expression associated with the conditional format or data validation. Can be a constant value, a string value, a cell reference, or a formula.

Formula2 returns the value or expression associated with the second part of a conditional format or data validation. Used only when the data validation conditional format Operator property is xlBetween or xlNotBetween (XlFormatConditionOperator). Can be a constant value, a string value, a cell reference, or a formula.

IgnoreBlank true if blank values are permitted by the range data validation.

IMEMode returns or sets the description of the Japanese input rules. Can be one of the XlIMEMode constants listed in the following table.

InCellDropdown true if data validation displays a drop-down list that contains acceptable values.

InputMessage returns or sets the data validation input message.

InputTitle returns or sets the title of the data-validation input dialog box. Read/write String. Limited to 32 characters.

Operator returns a Long value that represents the operator for the data validation. See XlFormatConditionOperator.

ShowError true if the data validation error message will be displayed whenever the user enters invalid data.

ShowInput true if the data validation input message will be displayed whenever the user selects a cell in the data validation range.

Type returns a Long value containing an XlDVType constant that represents the data type validation for a range.

Value returns a Boolean value that indicates if all the validation criteria are met (that is, if the range contains valid data).