PDA

View Full Version : [SOLVED] Autofilter with variable criteria & field



sllaksvb
10-19-2017, 01:29 PM
Hi all, facing this issue with a macro i'm creating.

I need to filter workbook MASTER based on the criteria in workbook REQUIREMENTS sheet REQ. I've managed to do so by putting it values for the criteria and field. However, I need this to accomodate for future alternatives where more categories/filters might be added into sheet REQ, which would require the autofilter to filter through more criterias and different fields.

I tried changing my 2 autofilters to:

For m = 3 To wb2.Sheets("Filter Control").Range("BQ1").End(xlToLeft).Column

arr1 = Range(Cells(m, 3), Cells(m, 6))

ws1.Range("A1").AutoFilter _
Field:=m + 1, _
Criteria1:=arr1, _
Operator:=xlFilterValues
Next m

to accomodate for new criteria, but instead it just returns all unique values in column A of MASTER.

Any help would be greatly appreciated!! Thank you!

SamT
10-21-2017, 08:50 AM
bump

sllaksvb
10-23-2017, 06:10 AM
Thank you SamT