Validation Object [Excel 2003 VBA Language Reference]

Range
Validation

Represents data validation for a worksheet range.

Using the Validation Object

Use the Validation property to return the Validation object. The following example changes the data validation for cell E5.

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

Use the Add method to add data validation to a range and create a new Validation object. The following example adds data validation to cell E5.

With Range("e5").Validation
    .Add Type:=xlValidateWholeNumber, _
        AlertStyle:=xlValidAlertInformation, _
        Minimum:="5", Maximum:="10"
    .InputTitle = "Integers"
    .ErrorTitle = "Integers"
    .InputMessage = "Enter an integer from five to ten"
    .ErrorMessage = "You must enter a number from five to ten"
End With

Properties | AlertStyle Property | Application Property | Creator Property | ErrorMessage Property | ErrorTitle Property | Formula1 Property | Formula2 Property | IgnoreBlank Property | IMEMode Property | InCellDropdown Property | InputMessage Property | InputTitle Property | Operator Property | Parent Property | ShowError Property | ShowInput Property | Type Property | Value Property

Methods | Add Method | Delete Method | Modify Method

Parent Objects | Range Collection

Child Objects