VBA Code to Select Filter Variables

kentster

New Member
Joined
Nov 22, 2016
Messages
28
Hi,

I have this code recorded from Excel 2013:

Code:
 ActiveSheet.Range("$A$5:$BY$922").AutoFilter Field:=31, Criteria1:=Array("0"), Operator:=xlFilterValues, Criteria2:=Array(0, "1/0/1900")

[end code]

It errors our if one of the variables is missing.  I can't have it do that.

I need it to capture either 0, 1/0/1900, or both.  The worst case is if none of them exist then is it feasible to use On Error GoTo Practice: at the beginning of the code?  And then under Practice: I would just have the same code but different variables....

I am doing this for 7 different columns and each column has the same criteria.  Once I get the first niled down, it should be a piece of cake for the others as I just change the "Field:=" value to match the column and the variables and the "On Error GoTo xxxxxx:"

Thanks again
Kent
 

Some videos you may like

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

kentster

New Member
Joined
Nov 22, 2016
Messages
28
FYI - I went a different route and this is no longer needed. I couldn't find a way to delete the original post.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,804
Messages
5,598,151
Members
414,214
Latest member
marketingnumbersguy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top