G
gimme_this_gimme_that
John Walkenbach uses the following code to sort a collection and to
remove duplicates.
Can it be modified to set a collection but to leave duplicates ?
Thanks.
' Using Walkenbach's NoDupes variable name eventhough duplicates are to
be preserved
For i = 1 To NoDupes.Count - 1
For j = i + 1 To NoDupes.Count
If NoDupes(i) > NoDupes(j) Then
Swap1 = NoDupes(i)
Swap2 = NoDupes(j)
NoDupes.Add Swap1, before:=j
NoDupes.Add Swap2, before:=i
NoDupes.Remove i + 1
NoDupes.Remove j + 1
End If
Next j
Next i
remove duplicates.
Can it be modified to set a collection but to leave duplicates ?
Thanks.
' Using Walkenbach's NoDupes variable name eventhough duplicates are to
be preserved
For i = 1 To NoDupes.Count - 1
For j = i + 1 To NoDupes.Count
If NoDupes(i) > NoDupes(j) Then
Swap1 = NoDupes(i)
Swap2 = NoDupes(j)
NoDupes.Add Swap1, before:=j
NoDupes.Add Swap2, before:=i
NoDupes.Remove i + 1
NoDupes.Remove j + 1
End If
Next j
Next i