Sub Test()
Dim Rng As Range
Columns("A:A").Insert Shift:=xlToRight
Set Rng = Range("A1:A" & Range("B65536").End(xlUp).Row)
With Rng
.FormulaR1C1 = "=COUNTIF(R1C2:R5C2,RC[1])"
.Resize(, 2).AutoFilter Field:=1, Criteria1:=">1", Operator:=xlAnd
.SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
Columns("A:A").Delete Shift:=xlToLeft
End Sub
Sub Delete_Duplicates()
Dim r As Long
Dim r2 As Long
Dim CurrentVal As String
Dim Unique As Boolean
For r = 1 To Range("A65536").End(xlUp).Row
CurrentVal = Range("A" & r).Value
Unique = True
For r2 = r + 1 To Range("A65536").End(xlUp).Row
If Range("A" & r2).Value = CurrentVal Then
Unique = False
Range("A" & r2).EntireRow.Delete
r2 = r2 - 1
End If
Next r2
If Unique = False Then
Range("A" & r).EntireRow.Delete
r = r - 1
End If
Next r
End Sub
Here's another method:
Code:Sub Delete_Duplicates() Dim r As Long Dim r2 As Long Dim CurrentVal As String Dim Unique As Boolean For r = 1 To Range("A65536").End(xlUp).Row CurrentVal = Range("A" & r).Value Unique = True For r2 = r + 1 To Range("A65536").End(xlUp).Row If Range("A" & r2).Value = CurrentVal Then Unique = False Range("A" & r2).EntireRow.Delete r2 = r2 - 1 End If Next r2 If Unique = False Then Range("A" & r).EntireRow.Delete r = r - 1 End If Next r End Sub