Delete Duplicates

dlatha01

Board Regular
Joined
Apr 7, 2009
Messages
65
Hi guys

Is there a way to delete duplicates from a spreadsheets, via macros or other routes?

Cheers

David
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
If you do a search on this board or even google it, you will find thousands of links which would answer your question.

Edit: you can either use VBA or use an advanced filter to delete duplicates, depends on the layout of your data and your requirement.
 
Upvote 0
Last edited:
Upvote 0
Try this macro and see if it's what you want. If you want the duplicates just cleared rather than actively deleted put apostrophes before the 2nd to last and 3rd to last lines
Code:
Sub deletedups()
Dim e
With CreateObject("Scripting.Dictionary")
For Each e In ActiveSheet.UsedRange
    If Not .exists(e.Value) Then
        .Add e.Value, Empty
    Else: e.Value = Empty
    End If
Next
End With
Application.ScreenUpdating = 0
ActiveSheet.UsedRange.SpecialCells(4).Delete xlUp
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

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