VBA to delete duplicate rows through out the current sheet.

ostlan

New Member
Joined
Apr 14, 2016
Messages
9
Hi,

I am trying to sort some VBA that will allow me to delete duplicate rows that could be anywhere in the current sheet.
The sheet consists of 9 columns and so the value in duplicate rows must be the same in each column for it to be counted as a duplicate.
I want to delete all duplicates but keep 1 copy of the row the search was based on.
I guess the best place to start would be to sort the sheet so it is at least a bit more uniformed.

Any help would be greatly appreciated. :)
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
If you sort the sheet you could then use the remove duplicates option on the data tab.
 
Upvote 0
If you sort the sheet you could then use the remove duplicates option on the data tab.
Thanks for your reply Fluff - but for this project it has to be part of a VBA scripted macro :)
 
Upvote 0
All you need to do is start the macro recorder, sort & remove duplicates then stop the recorder & you have your code. :)
 
Upvote 0
All you need to do is start the macro recorder, sort & remove duplicates then stop the recorder & you have your code. :)
Thanks Fluff - but this seems to produce some code I can't comprehend i.e.
ActiveSheet.Range("RESP_27e9f8cd18fd44feba6060c2cd6e1e1b_[#All]").
I may need to use the macro code in another script so not sure if this would affect the operation of other scripts.

Many thanks :)
 
Upvote 0
That looks like the name of a table.
 
Upvote 0
If you only have one table on the sheet you could use
VBA Code:
activesheet.ListObjects(1).DataBodyRange
 
Upvote 0

Forum statistics

Threads
1,213,532
Messages
6,114,177
Members
448,554
Latest member
Gleisner2

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