code help

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")
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top