ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code help (https://www.excelbanter.com/excel-programming/305670-code-help.html)

scrabtree[_2_]

code help
 
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")

Tom Ogilvy

code help
 
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

--
Regards,
Tom Ogilvy


"scrabtree" wrote in message
...
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")





All times are GMT +1. The time now is 06:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com