Compare rows in VBA

Misca

Well-known Member
Joined
Aug 12, 2009
Messages
1,749
Office Version
  1. 365
Platform
  1. Windows
How do I compare entire rows with each other?

I'm trying to write a macro that finds duplicate rows in CurrentRegion and deletes the duplicates but I'm lost with the code:

The CurrentRegion has headers and is sorted so the duplicates (if any) should be right ontop of eachother.

The problem is that there's 30 columns in each row and comparing cells one by one for each row is going to take a lot of time (there can be up to 65000 rows in the CurrentRegion).

What would be the best (=fastest?) way to do this?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hi,

I'd probably use advanced filter to create a de-duplicated version of the data on another worksheet.

Dom
 
Upvote 0
Unfortunately this is hard / impossible to do: The macro is going to update a larger database workbook in customer's location and I can't be sure what info has already been updated to this database.
 
Upvote 0
Unfortunately this is hard / impossible to do: The macro is going to update a larger database workbook in customer's location and I can't be sure what info has already been updated to this database.

Not quite sure what you mean. The code for doing the advanced filter is pretty straightforward and can mostly be obtained by using the macro recorder.

Dom
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,799
Members
449,095
Latest member
m_smith_solihull

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