Using VBA to filter multiple criteria

ajohns52

New Member
Joined
May 28, 2015
Messages
4
Hello,

I am trying to use VBA to filter multiple criteria by using the array function, however I am still getting an error saying the process can't be carried out.

The first column with data in it (Column B = Field 1) just has some terms such as LPV, LPA, LPG, LPT, LPZ. However I only want what's in the criterial array below.

The other column with data in it (Column C = Field 2) has numbers, but I only want numbers less than or equal to 10. See the code below.



Sub AutoFilter1()
With ActiveSheet
.AutoFilterMode = False

With Range("B1:C1")
.AutoFilter Field:=1, Criteria1:=Array("LPV", "LPA", "LPG"), Operator:=x1FilterValues
.AutoFilter Field:=2, Criteria1:="<=10"
End With


End With
End Sub
 
Last edited:

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
This is wrong
Code:
[COLOR=#ff0000]x1[/COLOR]FilterValues
it should be a lower case L rater than a 1 (one)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,109
Messages
6,128,883
Members
449,477
Latest member
panjongshing

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
Back
Top