Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
preserve last row while looking through a column of duplicate information
Is there a way to instead of deleting the extra rows after the first
duplicate is found, to delete all but the last one of the duplicates? As in, keep the last duplicate, discard the ones above it. I know the reverse can be done... Thanks for any direction! -Marcus |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
preserve last row while looking through a column of duplicate information
One way:
This will cycle through all cells in column A, starting at the bottom, and delete the entire row above it if it is a match. Sub delDups() For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1 Do Until Cells(i, 1).Offset(-1, 0).Text < Cells(i, 1).Text Cells(i, 1).Offset(-1, 0).EntireRow.Delete Loop Next i End Sub Marcusdmc wrote: Is there a way to instead of deleting the extra rows after the first duplicate is found, to delete all but the last one of the duplicates? As in, keep the last duplicate, discard the ones above it. I know the reverse can be done... Thanks for any direction! -Marcus |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Preserve Column Widths in Table when Reordering Columns | Excel Discussion (Misc queries) | |||
Duplicate information | Excel Worksheet Functions | |||
Duplicate Data -Adding information to another column in row & dele | Excel Discussion (Misc queries) | |||
Duplicate information | Excel Discussion (Misc queries) | |||
Preserve a range information | Excel Programming |