I am attempting to filter a column depending on a value in another cell. The value is used to identify the column number in a range. So if the value is 4, then I want to filter column 4.
This is what my table in excel looks like:
xtable image.jpg
In this screen shot, the value in Q3 = 4, so I want column V (which is the 4th column in my range as the range is from S to AC) to filter for the 1s.
So far I have this code which creates the filters and runs the filter. “Subject_PropertyTypeTitles” is the range name of the title row where the filters are created:
Application.Goto Reference:="Subject_PropertyTypeTitles"
Selection.AutoFilter
ActiveSheet.Range("$R$3:$AC$104").AutoFilter Field:=1, Criteria1:="Entry"
ActiveSheet.Range("$R$3:$AC$104").AutoFilter Field:=4, Criteria1:="1"
However, where it says “Autofilter Field:=4”, I want the 4 to be whatever number is in Q3.
Can you please help?
Thanks,
Jen
Bookmarks