![]() |
How to deleted duplicate record on columnA
I have big excel record, but on the columnA has a lots of dupluicate record,
how can I write a macro to delete them ColumnA aaa aaa bbb bbb ccc ccc I want be like this ColumnA aaa bbb ccc Thanks. Lillian |
How to deleted duplicate record on columnA
Sub sonic()
i = Cells(Rows.Count, "A").End(xlUp).Row For j = i To 2 Step -1 If Cells(j, "A").Value = Cells(j - 1, "A").Value Then Cells(j, "A").Delete End If Next End Sub -- Gary''s Student gsnu200709 "Lillian" wrote: I have big excel record, but on the columnA has a lots of dupluicate record, how can I write a macro to delete them ColumnA aaa aaa bbb bbb ccc ccc I want be like this ColumnA aaa bbb ccc Thanks. Lillian |
How to deleted duplicate record on columnA
Gary,
This look good, but only deleted columnA, but actually I would like deleted entire duplicated record, how did we do that. Thanks for all the help Lillian "Gary''s Student" wrote: Sub sonic() i = Cells(Rows.Count, "A").End(xlUp).Row For j = i To 2 Step -1 If Cells(j, "A").Value = Cells(j - 1, "A").Value Then Cells(j, "A").Delete End If Next End Sub -- Gary''s Student gsnu200709 "Lillian" wrote: I have big excel record, but on the columnA has a lots of dupluicate record, how can I write a macro to delete them ColumnA aaa aaa bbb bbb ccc ccc I want be like this ColumnA aaa bbb ccc Thanks. Lillian |
How to deleted duplicate record on columnA
Sub sonic()
i = Cells(Rows.Count, "A").End(xlUp).Row For j = i To 2 Step -1 If Cells(j, "A").Value = Cells(j - 1, "A").Value Then Cells(j, "A").EntireRow.Delete End If Next End Sub The one-line change deletes the row instead of just the cell. -- Gary's Student gsnu200709 "Lillian" wrote: Gary, This look good, but only deleted columnA, but actually I would like deleted entire duplicated record, how did we do that. Thanks for all the help Lillian "Gary''s Student" wrote: Sub sonic() i = Cells(Rows.Count, "A").End(xlUp).Row For j = i To 2 Step -1 If Cells(j, "A").Value = Cells(j - 1, "A").Value Then Cells(j, "A").Delete End If Next End Sub -- Gary''s Student gsnu200709 "Lillian" wrote: I have big excel record, but on the columnA has a lots of dupluicate record, how can I write a macro to delete them ColumnA aaa aaa bbb bbb ccc ccc I want be like this ColumnA aaa bbb ccc Thanks. Lillian |
How to deleted duplicate record on columnA
Thanks Gary, this one work
"Gary''s Student" wrote: Sub sonic() i = Cells(Rows.Count, "A").End(xlUp).Row For j = i To 2 Step -1 If Cells(j, "A").Value = Cells(j - 1, "A").Value Then Cells(j, "A").EntireRow.Delete End If Next End Sub The one-line change deletes the row instead of just the cell. -- Gary's Student gsnu200709 "Lillian" wrote: Gary, This look good, but only deleted columnA, but actually I would like deleted entire duplicated record, how did we do that. Thanks for all the help Lillian "Gary''s Student" wrote: Sub sonic() i = Cells(Rows.Count, "A").End(xlUp).Row For j = i To 2 Step -1 If Cells(j, "A").Value = Cells(j - 1, "A").Value Then Cells(j, "A").Delete End If Next End Sub -- Gary''s Student gsnu200709 "Lillian" wrote: I have big excel record, but on the columnA has a lots of dupluicate record, how can I write a macro to delete them ColumnA aaa aaa bbb bbb ccc ccc I want be like this ColumnA aaa bbb ccc Thanks. Lillian |
All times are GMT +1. The time now is 03:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com