AutoFilter Criteria Array Only Returns Data For One Element

wsnyder

Board Regular
Joined
Sep 23, 2018
Messages
223
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Using excel 365.

AutoFilter uses a Criteria Array, but only returning data for one of the elements of the array, nothing for the 2nd element.
I added a debug.print command to check the Array and both items are returned.
I reviewed the data and there are records in the data that match both array elements.

I am transferring a Range to the Array in case that might be the issue.
VBA Code:
            'Transfer criteria range to criteria array
                arr = rngCriteria

I tested the contents of the array. The contents are correct

VBA Code:
            For i = LBound(arr) To UBound(arr)
                Debug.Print i, arr(i, 1)
            Next i

Here is the AutoFilter snippet. It is only returning records that match the first element of the criteria array

VBA Code:
            lo.Range.AutoFilter _
                        Field:=5, _
                        Criteria1:=arr, _
                        Operator:=xlFilterValues

Thanks,
-w
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
maybe
VBA Code:
 arr = application.transpose(rngCriteria)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,544
Messages
6,120,126
Members
448,947
Latest member
test111

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