ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter in a macro (https://www.excelbanter.com/excel-programming/436909-autofilter-macro.html)

MarkN

Autofilter in a macro
 
Hello,

I have a workbook that uses several macros to filter data from the raw data
on sheet1 and then create tables on subsequent sheets. I did all of this by
using the macro recorder. The results I get are fine but the macros run quite
slowly. Is there a more efficient syntax to produce the results quicker,
currently the code looks like:

Sheets("master data list").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AC$10000").AutoFilter Field:=3, Criteria1:="AVV"
ActiveSheet.Range("$A$1:$AC$10000").AutoFilter Field:=23,
Criteria1:="=" & Format(CDate(critCorp), "mm/dd/yyyy"), Operator:=xlAnd,
Criteria2:="<=" & Format(CDate(critCorp), "mm/dd/yyyy")
--
Thanks in advance,
MarkN

Barb Reinhardt

Autofilter in a macro
 
You may want to look at your criteria for column 23. Is it really = and <=
the same date?

--
HTH,

Barb Reinhardt



"MarkN" wrote:

Hello,

I have a workbook that uses several macros to filter data from the raw data
on sheet1 and then create tables on subsequent sheets. I did all of this by
using the macro recorder. The results I get are fine but the macros run quite
slowly. Is there a more efficient syntax to produce the results quicker,
currently the code looks like:

Sheets("master data list").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AC$10000").AutoFilter Field:=3, Criteria1:="AVV"
ActiveSheet.Range("$A$1:$AC$10000").AutoFilter Field:=23,
Criteria1:="=" & Format(CDate(critCorp), "mm/dd/yyyy"), Operator:=xlAnd,
Criteria2:="<=" & Format(CDate(critCorp), "mm/dd/yyyy")
--
Thanks in advance,
MarkN



All times are GMT +1. The time now is 03:28 AM.

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