ErrorMessage Property

Applies To

Validation object.

Description

Returns or sets the data validation error message. Read/write String.

See Also

Add method (Validation object), ErrorTitle property, IgnoreBlank property, InCellDropdown property, InputMessage property.

Example

This example adds data validation to cell E5 and specifies both the input and error messages.

With Range("E5").Validation
    .Add Type:=xlValidateWholeNumber, _
        AlertStyle:= xlValidAlertStop, _
        Operator:=xlBetween, Formula1:="5", Formula2:="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