floggingmolly
Board Regular
- Joined
- Sep 14, 2019
- Messages
- 167
- Office Version
- 365
- Platform
- Windows
I have a worksheet with data in A3 - I 1400. Column A contains Station #'s. I want the user to be able to enter multiple station #'s in Row 2 (B2, C2, D2) and filter the data by those stations. If I use an array in the VBA it filters by the station #'s, but I want it to reference cells B2, C2, D2, etc. Is anyone able to assist? Below is the code I have with station #'s as an array but this obviously isn't what I need. I need the Criteria to be a range I'm guessing to reference cells? I can't figure it out. Any help would be greatly appreciated.
Code:
Sub Filter()
Sheet1.Range("A3:I3").AutoFilter Field:=1, _
Criteria1:=Array("11", "16"), _
Operator:=xlFilterValues
End Sub