Hello,
I need to compare values in columns D and E with a row beneath. If they match, I would like keep a row with the most recent date(column B) and delete the other. All data are sorted and duplicates are removed.
Here is how far I got with the code... . Please suggest the rest.
Thanks,
Lenna
I need to compare values in columns D and E with a row beneath. If they match, I would like keep a row with the most recent date(column B) and delete the other. All data are sorted and duplicates are removed.
Here is how far I got with the code... . Please suggest the rest.
Code:
Sub MostRecentDate()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = 2 To lr + 1
If
Range("D" & r).Value = Range("D" & r + 1).Value And _
Range("E" & r).Value = Range("E" & r + 1).Value Then
'some code
End If
Next r
End Sub
Lenna