Sub Macro5()
Range("A1:D" & [A65000].End(xlUp).Row).AdvancedFilter Action:=xlFilterInPlace, Unique:=True
For i = [A65000].End(xlUp).Row To 3 Step -1
If Cells(i, 1).EntireRow.Hidden = True Then Cells(i, 1).EntireRow.Delete
Next i
ActiveSheet.ShowAllData
End Sub