Sub DeleteUnique()
Dim lRow As Long
lRow = 2 'ASSUMING YOUR COLUMN HEADING IS IN FIRST ROW AND DATA IS STARTING FROM SECOND ROW
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Dim rng As Range, cell As Range
'Set rng = Range("K:K" & Sheet1.UsedRange.Rows.Count)
With Range("K2:K" & Sheet1.UsedRange.Rows.Count)
Do While lRow <= .Rows.Count
Debug.Print Cells(lRow, 11).Text & " - " & WorksheetFunction.CountIf(Range("K2:K" & Sheet1.UsedRange.Rows.Count), Cells(lRow, 11).Value)
If WorksheetFunction.CountIf(Range("K2:K" & Sheet1.UsedRange.Rows.Count), Cells(lRow, 11).Value) = 1 Then
Rows(lRow).delete
End If
lRow = lRow + 1
Loop
End With
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
|