Jun 25 2021 06:30 AM
Hello,
I would like to delete the duplicates (red ones) and keep those with the oldest date (green) with a macro on VBA.
Thank you in advance,
Frédéric
Jun 25 2021 06:47 AM
SolutionSort the range on column E, from oldest to newest.
Click Remove Duplicates on the Data tab of the ribbon.
Select only column A (ID), then click OK.
As a macro:
Sub RemoveDups()
Application.ScreenUpdating = False
With Range("A1").CurrentRegion
.Sort Key1:=Range("E1"), Header:=xlYes
.RemoveDuplicates Columns:=1, Header:=xlYes
End With
Application.ScreenUpdating = True
End Sub
Jun 25 2021 06:47 AM
SolutionSort the range on column E, from oldest to newest.
Click Remove Duplicates on the Data tab of the ribbon.
Select only column A (ID), then click OK.
As a macro:
Sub RemoveDups()
Application.ScreenUpdating = False
With Range("A1").CurrentRegion
.Sort Key1:=Range("E1"), Header:=xlYes
.RemoveDuplicates Columns:=1, Header:=xlYes
End With
Application.ScreenUpdating = True
End Sub