Version

SetValues Method

Sets the list of accepted values the cell can accept.
Syntax
'Declaration
 
Public Sub SetValues( _
   ByVal ParamArray values() As Object _
) 
public void SetValues( 
   params object[] values
)

Parameters

values
The list of accepted values.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionOccurs when values is null and the rule is currently applied to a Worksheet.
System.ArgumentExceptionOccurs when the values array is empty.
Remarks

If LimitedValueDataValidationRule.AllowNull is True, null values are allowed in addition to the list of accepted values.

All values will have ToString called on them to covert the accepted values list to a formula.

Note: the formula of accepted values is created by separating each value with a function parameter separator and concatenating them into a single string. So a list of 1, 2, and 3 would have the following formula created: ="1,2,3". However, if the decimal separator of the current culture is a comma (,) then a semicolon (;) will be used to separate the values instead. Because of this, if the ToString of a value returns a string which contains one of these separators, the value will be split into two or more allowed values.

Requirements

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

See Also