Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Enable Microsoft scripting library first via Tools > References > Microsoft Scripting Library/Runtime
- Public Function CountUnique(rng As range) As Integer
- Dim dict As Dictionary
- Dim cell As range
- Set dict = New Dictionary
- For Each cell In rng.Cells
- If Not dict.Exists(cell.Value) Then
- dict.Add cell.Value, 0
- End If
- Next
- CountUnique = dict.Count
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement