I think I captured everything. The reason I had it do 2 loops was because of the random potential for deletions. I figured this way the deletion wouldn't mess up the loop.
Sub RunMe()
Dim ws As Worksheet: Set ws = Sheets("Sheet1")
Dim icell As Long, LR As Long, rCell As Long
Dim c As Range, myRange As Range
Dim firstAddress
Application.ScreenUpdating = False
LR = ws.Range("A" & Rows.Count).End(xlUp).Row
For icell = LR To 1 Step -1
Set myRange = ws.Range("D" & icell)
With ws.Range("D1:D" & LR)
Set c = .Find(myRange.Value, LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If c.Address <> myRange.Address Then
If c.Offset(, -1).Value = myRange.Offset(, -1).Value And c.Offset(, -2).Value = myRange.Offset(, -2).Value And c.Offset(, -3).Value = myRange.Offset(, -3).Value Then
If c.Offset(, 1).Value > myRange.Offset(, 1).Value Then
c.Interior.ColorIndex = 3
Else
myRange.Interior.ColorIndex = 3
End If
End If
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
Next icell
For rCell = LR To 1 Step -1
If ws.Range("D" & rCell).Interior.ColorIndex = 3 Then
ws.Range("D" & rCell).EntireRow.Delete Shift:=xlUp
End If
Next rCell
Application.ScreenUpdating = True
End Sub
Bookmarks