Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to add values to a collection to display unique values. I have a
worksheet with comma separated values in a of column of cells. I am using the Split function to loop through the values and add them to the Collection. There are duplicate values in the string, I do not understand why they are still added to the Collection. Public Function RemoveDupes(c As Range) As String Dim i As Integer Dim itm Dim strItems As String Dim nStr() As String Dim nColl As New Collection nStr = Split(c, ",") For i = 0 To UBound(nStr) nColl.Add Item:=nStr(i) Next For Each itm In nColl Debug.Print itm strItems = strItems & itm & "," Next If Not Len(strItems) = 0 Then RemoveDupes = Left(strItems, Len(strItems) - 1) Else RemoveDupes = "" End If Set nColl = Nothing End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Unique Values, not Unique Records | Excel Discussion (Misc queries) | |||
Adding Unique Items to a Collection | Excel Discussion (Misc queries) | |||
Collection of case sensitive unique items | Excel Programming | |||
Add Unique item to Collection | Excel Programming | |||
Compare Listbox values with Collection values | Excel Programming |