code help

  • Thread starter Thread starter scrabtree
  • Start date Start date
S

scrabtree

Below is a code I am getting an error on. The error is on
the "Set rng" line. I know it has to do with my using an
advanced filter rather than an autofilter but I don't know
how to fix it.

PS...thanks for all the help!


Sheets("Stepdown").Select
Columns("B:B").AdvancedFilter Action:=xlFilterInPlace,
Unique:=True

Dim rng As Range
Set rng = Sheets("Stepdown").AutoFilter.Range
rng.Copy Destination:=Worksheets("Stepdown2").Range
("A1")
 
Use the built in capability to copy of the advanced filter:

Sheets("Stepdown").Select
Columns("B:B").AdvancedFilter _
Action:=xlFilterCopy, _
CopyToRange:=Worksheets("Stepdown2") _
.Range("A1"), Unique:=True

If you still need it filtered in place, repeat the advancedfilter action as
well.

Columns("B:B").AdvancedFilter _
Action:=xlFilterInPlace, _
Unique:=True
 
Back
Top