title: Filter multiple columns in table
body: <p>My code filters one column then prints.</p>
  <p>I need to filter based on two columns and then print. I.e. filter based on engineer name (column 1) and route (column 2). Right now, it filters on engineer name (column 1).</p>
  <pre class="lang-vb prettyprint-override"><code>Option Explicit
  Sub filterandprint()
  
      Dim TempWks As Worksheet
      Dim wks As Worksheet
  
      Dim myRng As Range
      Dim myCell As Range
                  
      'change to match your worksheet name
      Set wks = Worksheets(&quot;Table&quot;)
          
      Set TempWks = Worksheets.Add      'creates temporary worksheet
  
      wks.AutoFilterMode = False 'remove the arrows
  
      'assumes headers only in row 1, columns(1) will be the number of the column you base your filtering
      'this copies the unique filtering and pastes it on a new temp worksheet
      wks.Columns(1).AdvancedFilter Action:=xlFilterCopy, _
        CopyToRange:=TempWks.Range(&quot;A1&quot;), Unique:=True
  
      With TempWks
          Set myRng = .Range(&quot;a2&quot;, .Cells(.Rows.Count, &quot;A&quot;).End(xlUp))
      End With
  
      'looping
      With wks
          For Each myCell In myRng.Cells
              .UsedRange.AutoFilter Field:=1, Criteria1:=myCell.Value
              '.UsedRange.AutoFilter Field:=2, Criteria1:=myCell.Value
              .PrintOut Preview:=True
          Next myCell
      End With
  
      Application.DisplayAlerts = False
      TempWks.Delete    'deletes temporary worksheet
      Application.DisplayAlerts = True
  
  End Sub
  </code></pre>