Click here to Skip to main content
14,696,502 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi folks,

I am getting a runtime error 1004 related to auto filtering and this is the piece of code that is highlighted in yellow when I open the debugger. But I am not seeing an error here. Can you please point it out? Thanks!


' Filter Drop Date - Field 12
ActiveSheet.Range("$A$1:$L$5000").AutoFilter Field:=12, Operator:= _
xlFilterValues, Criteria2:=Array(2, a)

What I have tried:

I have tried unfiltering the source data and refiltering to no avail.
ZurdoDev 16-Jul-20 13:20pm
Make sure the ActiveSheet IS what you actually think it is.
Member 14890292 16-Jul-20 14:14pm
What's the best way to do that?
ZurdoDev 16-Jul-20 14:15pm
Depends on what you are doing. You can also reference sheets through their index but I don't know how you are running this and perhaps the wrong sheet is active when this code is called.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900