AutoFilter with an Array

jdk195

New Member
Joined
Aug 8, 2011
Messages
1
I have been trying to get an autofilter with an array working correctly. I have to filter a very large sheet by 30 or more criteria. I receive a new file each week and the information varies. I created a macro based off of the posts I found on here. I am just learning VBA so I only get the basics. The problems I am having with the code is it filters everything out. If I changed the Operator to xlOr it only gives me the first two in the array.

Below is the code that I have. I basically need to filter column I by certain words that start the text in those cells. I only have three criteria in the code because I wanted to get it working before I added all the others. I need to be able to clear the filter and work with the other data also. The autofilter would be perfect, but it only allows for 2 criteria. Any help is appreciated or if you have a different solution that would work I would like to see it. Thanks!

Sub Web_Search3()
Dim Myarray() As Variant
Myarray = Array("Apache*", "Tomcat*", "Web Server*")
ActiveSheet.Range("$A$1:$S$9873").AutoFilter Field:=9, Criteria1:= _
Myarray, Operator:=xlFilterValues
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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