Hello,
What I'm trying to do is to count the number of unique values in multiple range on a sheet. I've found a solution on your forum that do it.
With list.count I can get the number of unique value but I've tried a lot of thing to get those value and I'm not able to do it.
If list.count returns 5, I would like to be able to get the 5 different value.
Thanks!!
JP
What I'm trying to do is to count the number of unique values in multiple range on a sheet. I've found a solution on your forum that do it.
With list.count I can get the number of unique value but I've tried a lot of thing to get those value and I'm not able to do it.
If list.count returns 5, I would like to be able to get the 5 different value.
VBA Code:
Private Sub CommandButton2_Click()
Dim Rng As Range, List As Object
Set List = CreateObject("Scripting.Dictionary")
For Each Rng In Range("G5:G18")
If Rng.Value <> "" Then
If Not List.Exists(Rng.Value) Then List.Add Rng.Value, Nothing
End If
Next
For Each Rng In Range("G22:G28")
If Rng.Value <> "" Then
If Not List.Exists(Rng.Value) Then List.Add Rng.Value, Nothing
End If
Next
For Each Rng In Range("G32:G37")
If Rng.Value <> "" Then
If Not List.Exists(Rng.Value) Then List.Add Rng.Value, Nothing
End If
Next
For Each Rng In Range("G42:G48")
If Rng.Value <> "" Then
If Not List.Exists(Rng.Value) Then List.Add Rng.Value, Nothing
End If
Next
For Each Rng In Range("G52:G61")
If Rng.Value <> "" Then
If Not List.Exists(Rng.Value) Then List.Add Rng.Value, Nothing
End If
Next
End Sub
Thanks!!
JP