title: Excel VBA Autofilter field as a variable
body: <p>I am trying to develop a code that will autofilter a field, that will change month to month.</p>
  
  <p>I have a userform where the user selects the reporting month, then the script finds that month across the top of a structured table, and then drops down 1 row to select the header of the structured table. upon clicking "OK" on the user form.</p>
  
  <p>As the field number "column" will change each time I need to enter this as a variable. I have tried a number of different solutions from other peoples posts, but still no luck.</p>
  
  <p>I don't remember all the different combinations I've tried now.</p>
  
  <pre><code>Private Sub cbOK_Click()
  Sheets("Weekly Timesheet").Select
  Sheets("Weekly Timesheet").Range("H5").Select
  ActiveCell.value = cboRMonth.value
  Unload Me
  
  ReportMonth = cboRMonth.value
  MsgBox ReportMonth
  
  Sheets("Tracking (DAYS)").Select
  Sheets("Tracking (DAYS)").Range("N2").Select
  
  Do Until ActiveCell = ReportMonth
  ActiveCell.Offset(0, 1).Select
  Loop
  
  ActiveCell.Offset(1, 0).Select
  
  'Tells me what the name of the header is (just to make sure I've got the 
  right one selected).
  Dim Col As String
  Col = ActiveCell
  MsgBox Col
  
  Dim lCol As Long
  lCol = ActiveCell.Column
  
  ActiveSheet.ListObjects("Tracking_DAYS").Range(lCol).AutoFilter _
  Criterial:="&gt;0", _
  Operator:=x1FilterValues
  
  End Sub
  </code></pre>
  
  <p>I'm expecting to be able to filter a column of the table based on the output of the userform to values greater than 0.</p>