Delete/hide duplicate rows

Drea567

New Member
Joined
Aug 14, 2006
Messages
4
Hi.

I am working with reports I run off a database, and I need to try to keep track of the new additions to the lists after I run them about twice a month. (I wish this database was more dynamic and there was a better way to keep track than running static reports all the time!)

My question is: Is there a way to delete any dupilacate rows after I copy and paste from the previous report? It would be so helpful to be able to identify any new entries since the last report.

Here is an example of what I am working with....
Discon_8-29-06.xls
ABCDEFGHIJ
125755"HANG.TIN VOTVE.PUMPKN.X3H1024EA1272**
2284724"FIBER OPTIC"TWIG"TREEH9612.5EA424**
3284724"FIBER OPTIC"TWIG"TREEH9612.5EA424**
4287520"HARVEST BERRY"WREATHH4617.5EA224
5287520"HARVEST BERRY"WREATHH4617.5EA224
Sheet5


The rows in red font are the newest report, the rows in black font are from the old report. Having the old data there, with the new data highlighted somehow would be ideal, but not nessisary. Deleting all the old data and only leaving the new data listed is just fine.

Any ideas?


Thanks so much!!
~Drea567
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You can use the advanced filter to show only the unique data in a range. It will hide the duplicate rows.

If you want to delete the duplicate rows, you could use this macro. It runs the advanced filter to hide the duplicate rows, but then deletes the duplicates.

Code:
Sub test()
Dim LastRow As Long, DataRng As Range, ChkRng As Range

'finds the last used row on the sheet
LastRow = Cells.Find("*", after:=Range("A1"), searchdirection:=xlPrevious).Row

'range of data (assuming row 1 is a column header and data starts in row 2)
Set DataRng = Range("A1:I" & LastRow)

'column J will be used to mark the duplicates
Set ChkRng = Range("J1:J" & LastRow)

'use advanced filter to show only unique entries
DataRng.AdvancedFilter Action:=xlFilterInPlace, Unique:=True

'mark the visible rows with an 'x' in column J
ChkRng.SpecialCells(xlCellTypeVisible).Value = "x"

'remove filter
On Error Resume Next
ActiveSheet.ShowAllData

'delete any rows that do not have an 'x' (the duplicates) in column J
ChkRng.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0

'delete any data in column J
ChkRng.ClearContents

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top