Description
A DataValidation object represents a rule for validating data entered in cells. The rule may be applied to a cell or a set of cells. The Workbook class contains several CreateDataValidation methods for creating DataValidation
objects. To apply a DataValidation
object to a cell or group of cells, use Area.SetDataValidation or Range.SetDataValidation.
C#
vb.net
Remarks
In Microsoft Excel, data validation rules are created through the Data Validation dialog. To open this dialog, open the Data menu and select Validation.Examples
C#
vb.net
Properties
Name |
Description |
---|---|
Returns the type of value that may be entered in a cell. | |
Returns the type of comparison that will be used to validate a value entered in a cell with a data validation rule. | |
Sets or returns the content of the error alert message displayed when invalid data is entered in a cell. | |
Sets or returns the style of error alert to display if error alerts are enabled. | |
Sets or returns the title of the error alert dialog that is displayed when invalid data is entered in a cell. | |
Sets or returns whether the data validation rule should ignore blank cells. | |
Sets or returns the content of the input message dialog that is displayed when the user selects a cell with a data validation rule. | |
Sets or returns the minimum value that may be entered in a cell with a data validation rule. | |
Sets or returns the maximum value that may be entered in a cell with a data validation rule. | |
Sets or returns whether Excel should display an error alert if invalid data is entered. | |
Sets or returns whether to show a message when the user selects a cell to which a data validation rule applies. | |
Sets or returns the title of the input message dialog that is displayed when the user selects a cell with a data validation rule. | |
Sets or returns whether a drop-down list will be used to display valid values. |
Methods
Name |
Description |
---|---|
Sets all properties of the DataValidation object to an uninitialized state. | |
Sets the allowed data type, comparison type, and minimum value to use when validating a cell entry. | |
SetAllowedType(ValidationType, ComparisonType, Object, Object) |
Sets the allowed data type, comparison type, and minimum and maximum values to use when validating a cell entry. |
Sets the allowed data type and a set of valid values to use when validating a cell entry. |
Nested Classes
Name |
Description |
---|---|
The type of comparison that will be used for validating the value of the cell. | |
Type style of the icon in the error alert message box. | |
The data type allowed as the cell's value. |