Exception | Description |
---|---|
System.ArgumentException | Occurs when address is not a valid cell or regions address. |
The way in which the cell value is compared to the lower constraint formula's value is determined by the ValidationOperator as well as the ValueConstraintDataValidationRule.ValidationCriteria.
Depending on the ValidationCriteria of the rule, either the cell value itself or the length of the cell value's text equivalent is compared to the lower constraint formula's value.
When the ValidationOperator is Between, the value must be greater than or equal to the lower constraint and less than or equal to the upper constraint. When the ValidationOperator is NotBetween, the value must be less than the lower constraint or greater than the upper constraint.
The address passed in is only needed if relative addresses are used in the the formula. For example, consider the formula applied is =B1, and the data validation rule is applied to the region A1:A5. If you get the formula for A1, the formula =B1 will be returned. If you get the formula for A2, =B2 will be returned. Similarly, for cell A5, =B5 will be returned. However, if the formula contains no references or all absolute references, the address is ignored. So in the previous example, if the original formula was =$B$1, the same formula will be returned regardless of the specified address.
address can be any valid cell or region reference on a worksheet. If a region address is specified, the top-left cell or the region is used. The cell or region specified does not need to have the data validation rule applied to it. Any reference is allowed.
The cell reference mode with which to parse address will be assumed to be A1, unless the data validation rule is applied to a worksheet which is in a workbook, in which case the Workbook.CellReferenceMode will be used.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
TwoConstraintDataValidationRule Class
TwoConstraintDataValidationRule Members
Overload List
TryGetLowerConstraint(Double) Method
TryGetLowerConstraint(DateTime) Method
TryGetLowerConstraint(TimeSpan) Method
GetLowerConstraintFormula(String,WorkbookFormat,CellReferenceMode,CultureInfo) Method
GetUpperConstraintFormula(String) Method
GetUpperConstraintFormula(String,WorkbookFormat,CellReferenceMode,CultureInfo) Method
SetLowerConstraintFormula(String,String) Method
SetLowerConstraintFormula(String,String,WorkbookFormat,CellReferenceMode,CultureInfo) Method
ValidationOperator Property
ValidationCriteria Property