Auto filter using array as criteria, where some of the array is blank.

moezaremia

New Member
Joined
Jan 23, 2017
Messages
2
I am creating a search sheet, where the user selects which filter they want to apply using a check box and can filter for multiple terms at once. Therefore I need the criteria to be an array. But I am experiencing two problems;

1. For some reason, I can search two values in the array, but once I up it to three it stops working (ie if my array consists of just the value in B3 and B4 it works, but once I add B5 it stops working). I've tried all the filters individually and they all seem to work fine.

2. The values in the array are links to the correct cell on the work sheet, when the cell is empty it returns no values for the filter!
For instance if there is a value for B4 and B3 but nothing in cell B5, the filter returns nothing.

Here is the line

Code:
Sheets("PAWS Claims").Range("A1").CurrentRegion.AutoFilter Field:=16, Criteria1:=Array("*" & Sheets("Summary").Range("B3") & "*", "*" & Sheets("Summary").Range("B4") & "*", "*" & Sheets("Summary").Range("B4") & "*"), Operator:=xlFilterValues

I hope someone can help me trouble shoot this!

Thanks in advance
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

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