Removing Duplicates in a string list by NandakumarAS (
This code sample is for removing duplicates in a string list.
Private Function FindDuplicate(a) For i = 0 To UBound(a) For j = i + 1 To UBound(a) If a(i) = a(j) Then a(i) = "" End If Next j Next i strtemp = Join(a, ",") Do While InStr(1, strtemp, ",,") strtemp = Replace(strtemp, ",,", ",") Loop If Left(strtemp, 1) = "," Then strtemp = Mid(strtemp, 2, Len(strtemp) - 1) If Right(strtemp, 1) = "," Then strtemp = Mid(strtemp, 1, Len(strtemp) - 1) b = Split(strtemp, ",") End Function