I have the following code that copies unique values and pastes them in a new column. However I get an error saying "Advanced Method of Range Class Failed". However when I debug the program and without changing the code click the run button, the macro runs smoothly. Not sure why an error occurs originally.
Here is the code:
Dim W2 As Worksheet
Set W2 = Worksheets("Tickets&VCON")
W2.Range("W3:AQ52").ClearContents
'Copy unique values for netting
Application.CutCopyMode = False
W2.Range("B2:B52").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("X2:X52"), Unique:=True