ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter all worksheets in workbook (https://www.excelbanter.com/excel-programming/356951-filter-all-worksheets-workbook.html)

duncanidaho

Filter all worksheets in workbook
 
I have a workbook with 100 sheets in it. I have a macro that goes
through each sheet and call
a procedure that filters a specific column. The macro works fine, but I
like to know if any one knows a faster and more efficent way to do the
same macro. Maybe without using a Select method. Here is a sample of
my macro:

Sheets("1").Select
Selection.AutoFilter Field:=3, Criteria1:="=1", Operator:=xlAnd
Call filtercopy
Selection.AutoFilter Field:=3
Sheets("2").Select
Selection.AutoFilter Field:=3, Criteria1:="=1", Operator:=xlAnd
Call filtercopy
Selection.AutoFilter Field:=3
Sheets("3").Select
Selection.AutoFilter Field:=3, Criteria1:="=1", Operator:=xlAnd
Call filtercopy

And the Call Filtercopy procedure is as follows:


Selection.copy
Windows("filterresults.xls").activate
Cells(Rows.Count, "a").End(xlUp).Offset(1, 0).Select
ActiveSheet.Paste
Windows("results.xls").activate


Thank you for any help.



All times are GMT +1. The time now is 05:25 PM.

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