This will be a lot faster, but bear in mind it will alter the original
string:
Function ReplaceDupsInCSV(str As String) As String
Dim i As Long
For i = Len(str) - 1 To 1 Step -3
If InStr(1, str, Mid$(str, i, 2)) < i Then
Mid$(str, i, 2) = "--"
End If
Next i
ReplaceDupsInCSV = Replace(str, ",--", vbNullString)
End Function
You could make it a lot faster still if you use one of the Replace functions
he
http://www.xbeat.net/vbspeed/c_Replace.htm
RBS
"geniusideas" wrote in message
...
Hi,
In VBA how to remove duplicate text seperated by comma example :
Example : One Cells contained
Before - AE,AE,DE,BE,CE,CE,FE,GE,GE
After - AE,DE,BE,CE,FE,GE
Can some one give me the code.Thanks