Created
April 15, 2014 15:55
-
-
Save agbishara/10743531 to your computer and use it in GitHub Desktop.
This takes something like a list of names and returns a dictionary of unique ones you can loop through
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uniqueValues(Range("sheet!D:D")) | |
| Function uniqueValues(InputRange As Range) | |
| Dim dict As New Scripting.Dictionary | |
| Dim cell As Range | |
| For Each cell In InputRange | |
| If cell.Rows.Hidden = False Then | |
| 'if this row gives you a error its because one of your cells has a #NA, fix the data! | |
| If cell.Value <> "" Then | |
| If Not dict.Exists(cell.Value) Then | |
| dict.Add cell.Value, cell.Value | |
| End If | |
| End If | |
| End If | |
| Next cell | |
| Set uniqueValues = dict | |
| End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment