The code below is currently deleting all duplicate occurances, including the original, found in column A. I would like to modify the code below to delete all duplicates based on columns A, B, C & D. To clarify, for rows 1 and 2 if columns A match, B match, c match and d match both rows would be deleted. Would anyone be able to assist? I believe an array is needed here, but unsure how. Thanks!
Dim toDel5(), p As Long
Dim RNG5 As Range, Cell5 As Long
Set RNG5 = Range("a1:a4000") 'set your range here
For Cell5 = 1 To RNG5.Cells.Count
If Application.CountIf(RNG5, RNG5(Cell5)) > 1 Then
ReDim Preserve toDel5(p)
toDel5(p) = RNG5(Cell5).Address
p = p + 1
End If
Next
On Error GoTo NO_DUPLICATES
For p = UBound(toDel5) To LBound(toDel5) Step -1
Range(toDel5(p)).EntireRow.Delete
Next p
On Error GoTo 0
End With
NO_DUPLICATES:
RemoveDuplicates