Sub DeleteDupes()
Dim Iloop As Integer
Dim Numrows As Integer
'Turn off warnings, etc.
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Numrows = Range("A20").End(xlUp).Row
Range("A1:B" & Numrows).Select
For Iloop = Numrows To 2 Step -1
'If value in col B of 2nd row is = value in col B of 1st row
If Cells(Iloop, "B") = Cells(Iloop - 1, "B") Then
'If value (date) in col A of 2nd row is < today or > 30 days from now
If Cells(Iloop, "A") < Date Or Cells(Iloop, "A") > Date + 30 Then
'Delete 2nd row
Rows(Iloop).Delete
End If
End If
Next Iloop
'Turn on warnings, etc.
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks