I have this excel VBA code
Sub Module()
Range(\"A1:A10\").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range(\"D1\"), Unique:=True
End Sub
An alternative approach, which doesn't require a header.
Sub Module()
Application.ScreenUpdating = False
With Range("A1:A10")
.Copy .Offset(, 3)
.Offset(, 3).RemoveDuplicates Columns:=1, Header:=xlNo
End With
Application.ScreenUpdating = True
End Sub
Insert another cell above cell A1. Write "Header" or any other text in this box. Change the range to A1:A11. This should solve your problem.