hi thup_98, try:
Sub test()

Columns(1).Insert
LastRow = Cells(Rows.Count, 2).End(xlUp).Row
Range("A2").FormulaArray = "=MIN(IF($C$2:$C$" & LastRow & "=C2,$D$2:$D$" & LastRow & "))=D2"
Range("A2:A" & LastRow).FillDown
Range("A2:A" & LastRow).Value = Range("A2:A" & LastRow).Value
For v = LastRow To 2 Step -1
    If Cells(v, 1) = False Then
        Rows(v).Delete
    End If
Next v
Columns(1).Delete

End Sub