title: Apply multiple filters based on user input (VBA)
body: <p>I want to ask the user:</p>
  
  <ol>
  <li>Which field/column to apply filters to?</li>
  <li>How many filters are to be applied? </li>
  </ol>
  
  <p>I want to take those <em>n</em> filters as input and apply them to the field of that column.</p>
  
  <p>Refer these images:
  <a href="https://i.stack.imgur.com/6ut9O.jpg" rel="nofollow noreferrer">Before applying filters</a>,
  <a href="https://i.stack.imgur.com/vEL58.jpg" rel="nofollow noreferrer">After applying filters to Column A</a></p>
  
  <p>Code:</p>
  
  <pre><code>Sub MultiFilter()
  Dim colNumber As Integer, numberOfFilters As Integer
  Dim filters(10) As String
  
  'Column number to apply filters to
  colNumber = InputBox("Enter column number to apply filter to (Column A = 1, B = 2, etc.)")
  
  'Number of filters to apply
  numberOfFilters = InputBox("Number of filters to apply to Column " &amp; colNumber)
  
  'Take multiple filters as input
  For i = 0 To numberOfFilters - 1
      filters(i) = InputBox("Filter #" &amp; i + 1)
  Next i
  
  'Apply multiple filters
  With ThisWorkbook.Sheets("Sheet1")
      .Activate
      .Range("A1").Select
      .Range(Selection, Selection.End(xlToRight)).Select
      Selection.AutoFilter
      For i = 0 To numberOfFilters - 1
          'ISSUE!
          Selection.AutoFilter field:=colNumber, Criteria1:=filters(i)
      Next i
  End With
  End Sub
  </code></pre>
  
  <p>Inputs: 1, 2, A, B</p>
  
  <p>I realise that I'm selecting over <code>Criteria1</code> multiple times. I've come across the following code:</p>
  
  <p><code>Range("A1:D10").AutoFilter Field:=1, Criteria1:=Array("A", "B"), Operator:=xlFilterValues</code></p>
  
  <p>The above code works perfectly, but I have to hard code the values "A" and "B". Is there a way to replace that with <em>n</em> user inputs?</p>
  
  <p>Any help would be appreciated!</p>
  
  <p><strong>EDIT:</strong>
  Going a step further, how do I take <em>number of columns</em> as a user input and apply multiple filters to multiple columns?</p>
  
  <p><em>Example:</em>
  (Refer images)</p>
  
  <p>Columns: 1, 2 ("Doc Type", "Year")
  Filters: 2 in column 1 ("A", "C"), 2 in column 2 ("2016", "2017")</p>