Hi All,
I have a database which includes different countries names in single cell.
I like to remove the duplicate countries and keep an unique name for each country is enough.
I've attached example file for reference.
Regards
Elango
Hi All,
I have a database which includes different countries names in single cell.
I like to remove the duplicate countries and keep an unique name for each country is enough.
I've attached example file for reference.
Regards
Elango
Sub Demo() With [A1].CurrentRegion For R& = 2 To .Rows.Count SP = Split(.Cells(R, 1).Text, ", ") If UBound(SP) > 0 Then T$ = SP(0): SP = Filter(SP, T, False) Do Until UBound(SP) < 0 T = T & ", " & SP(0): SP = Filter(SP, SP(0), False) Loop .Cells(R, 1).Value = T End If Next End With End Sub
Last edited by Marc L; 04-02-2014 at 06:36 PM.
Hi Marc,
Thank you so much for the code. Which is working fine in the example file. Which not working in the data which i have.
My data range starts is from J27 and ends based on the availability of data. I have modified the code, however it is not working
Please help me!!!
Heres another way..
See attachment for working example..
Private Sub CommandButton1_Click() Dim it, c, j As Long With CreateObject("scripting.dictionary") For Each c In Sheets("Ex").Range("J27:J" & Sheets("Ex").Range("J" & Rows.Count).End(xlUp).Row).SpecialCells(2) it = Split(c, ",") For j = LBound(it) To UBound(it) x0 = .Item(Trim(it(j))) Next j c.Value = Join(.Keys, ",") .RemoveAll Next c End With End Sub
Hi Apo,
I followed your way it worked perfectly. I really appreciate your help!
Thanks a lot!!!!
Elango
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks