|
|
Question : Excel Duplicate Removal Help!
|
|
Hi i have a spreadsheet with about 15,000 rows in each and i need to remove the duplicates down the rows... the rows currently appear as following:
Yahoo-Airparks-Button-88x31 2/13/2003 12:43:43 PM 36 Yahoo-Airparks-Button-88x31 2/13/2003 12:44:44 PM 36 Yahoo-Airparks-Button-88x31 2/13/2003 12:44:58 PM 36 Yahoo-Airparks-Button-88x31 2/13/2003 3:18:05 PM 58 Yahoo-Airparks-Button-88x31 2/13/2003 3:18:21 PM 58 Yahoo-Airparks-Button-88x31 2/13/2003 3:19:03 PM 58
The first part Yahoo being one row, the second part being the date, the third part being the time, and the 4 part being the amount. The amount is the duplicate bit, i need to remove all the rows following the first 36 and first 58 etc. so that it is left with just one.
Can anyone give me any ideas on how this can be done?!
Thanks a lot
Dom
|
Answer : Excel Duplicate Removal Help!
|
|
I so Wou have some blanck row so You should use this one that jump to the next one when it finds a empty row. Change the 65535 with the no of last row.
Sub test1() temp = 0 For a = 2 To 65535 ' ~~~~~ look in all cells to find tha last one
If Worksheets("sheet1").Cells(a, 4) > 0 Then If Worksheets("sheet1").Cells(a, 4) = temp Then ' ~~~~~ verify if date has appeared exaclly before Rows(a).Select '~~~~~ if the value is duplicate consecutivelly then delete that row Selection.Delete Shift:=xlUp a = a - 1 ' decrease the controle because You deleted a row and You don't whant to miss a row Else temp = Worksheets("sheet1").Cells(a, 4) End If End If Next a End Sub
You can change the sheet1 with the name of Your sheet
What is the progress?
|
|
|
|
|