how can i copy unique values from a column in one Excel sheet to a row in another excel sheet using vba code?
i have a list of values at sheet1 column B which contains duplictes, and i want to copy it to sheet 2 row 1 without duplicates, i have tried:
Public Sub Test()
ActiveSheet.Range("B2:B65536").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheets(2).Range("D1"), Unique:=True
End Sub
but it does not work and also does not use the fact that not all of the column contains values.
how can i do that?