Delete repeated values

  • Thread starter Thread starter Aladino
  • Start date Start date
A

Aladino

Hi,

I need to delete the repeated data but all of it. I´ve tried to use a
filter but it doesn´t work because the repeated data stays. Example:

1
2
3
3

After runnig the macro or filter sholud appear this

1
2


Hope u can help. Thanks
 
This will work for the example provided.

Sub deletealldups()
mc = 1 ' column A
On Error Resume Next
For i = Cells(Rows.Count, mc).End(xlUp).Row To 1 Step -1
If Cells(i - 1, mc) = Cells(i, mc) Then
Rows(i - 1).Resize(2).Delete
End If
Next i
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
Hi,

I need to delete the repeated data but all of it. I´ve tried to use a
filter but it doesn´t work because the repeated data stays. Example:

1
2
3
3

After runnig the macro or filter sholud appear this

1
2


Hope u can help. Thanks
 
This will delete for all duplicates if the count is more than 1

Sub deletealldups()
mc = 1 ' column A
On Error Resume Next
For i = Cells(Rows.Count, mc).End(xlUp).Row To 1 Step -1
numtogo = Application.CountIf(Columns(mc), Cells(i, mc))
If numtogo > 1 Then
Rows(i - numtogo + 1).Resize(numtogo).Delete
End If
Next i
End Sub
 
Back
Top