Spreadsheet.GetUniqueValues
This function returns sorted array of all distinct, non-MD values as integers for variable VarNo.
| Syntax | Parameters | Return Value |
|---|---|---|
Sub Spreadsheet.GetUniqueValues( _
VarNo As Integer, _
EvalSelectionConditions As Boolean, _
ByRef Values As Double(), _
Optional ByRef Labels As Variant)
|
The variable number to retrieve the unique values from. Type: Integer
Whether or not to include the spreadsheets selection conditions. Type: Boolean
Array of Doubles where the unique values of the specified variable will be stored. Type: Double()
Variant value where the variables text labels will be stored. Type: Variant |
This function does not return a value. |
SVB Example
Getting the unique values from a spreadsheet:
Option Base 1
Sub Main
Dim spr As Spreadsheet
'assigns the active spreadsheet to the object spr
Set spr = ActiveSpreadsheet
Dim values() As Double
'get the unique values and store them into the array values()
'if the variable contains text labels they will be stored in the variable, labels
spr.GetUniqueValues(1,False,values(),labels)
Dim outputspr As Spreadsheet
'create an output spreadsheet to display the returned values
Set outputspr = Spreadsheets.New("Unique Values")
'set the size of the spreadsheet
outputspr.SetSize(UBound(values()),2)
'place the data from the values array into variable 1 of the spreadsheet
outputspr.VData(1) = values()
'loop through the labels and place them in variable 2
'if there were no text labels in the original spreadsheet,
'variable 2 in the output spreadsheet will be blank
For i = 1 To UBound(labels)
outputspr.Value(i,2) = labels(i)
Next i
'display the output spreadsheet
outputspr.Visible = True
End Sub