Multiple criteria in filters, pre 2007

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
Working in VB, is it possible to have more than 2 filter criteria in an autofilter in pre 2007 Excel?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Jon von der Heyden

MrExcel MVP, Moderator
Joined
Apr 6, 2004
Messages
10,808
Office Version
  1. 365
Platform
  1. Windows
Or, depending on what you are doing, you could store the criteria in an array and then loop through that array, assigning each item to the filter. For instance, to delete rows matching more than two criteria:
Code:
Dim varArr as Variant, lngArrItem as Long
varArr=Array("a","b","c")

For lngArrItem = Lbound(varArr) to Ubound(varArr)
    With Range("A1:A100")
        .Filter Field:=1, Criteria1:=varArr(lngArrItem)
        .Offset(1).SpecialCells(12).EntireRow.Delete
        .AutoFilter
    End With
Next lngArrItem

You could adapt for copy too...
 

Weaver

Well-known Member
Joined
Sep 10, 2008
Messages
5,196
Nice idea Jon, in fact I think I've suggested similar myself.

My problem is they have to display at the same time tho.

Anyone know if there's an advanced filter wizard kicking around?
 

Watch MrExcel Video

Forum statistics

Threads
1,133,272
Messages
5,657,776
Members
418,413
Latest member
Radoslaw Poprawski

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