Autofilter with Array as Criteria

smpatty08

Board Regular
Joined
May 16, 2014
Messages
155
I am trying to autofilter a range with an array that I declared from a different range, but the autofilter will only use the last value of the array as criteria.
For instance, Range("B6:B10") contains the data with which I want to filter Range("A1:A114"), but my range is only filtered by what is in Range("B10"). This code is part of a much longer piece of code and the range which contains my filter criteria will be dynamic. The code is posted below.
Code:
Sub Test()


Dim Array1 As Variant
Array1 = Application.Transpose(SampleResults.Range(SampleResults.Range("B6"), SampleResults.Range("B6").End(xlDown)))
RawData.Columns(1).AutoFilter Field:=1, Criteria1:=Array1


End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Try
Code:
rawdata.Columns(1).AutoFilter 1, array1, xlFilterValues
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,970
Messages
6,175,703
Members
452,667
Latest member
vanessavalentino83

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