title: How to autofilter continuously for two fields with two different criterias in vba?
body: <p>Search 1</p>
  
  <p><img src="https://i.stack.imgur.com/EEj57.png" alt="enter image description here"></p>
  
  <p>Continue with Search 2</p>
  
  <p><img src="https://i.stack.imgur.com/l681L.png" alt="enter image description here"></p>
  
  <p>And a Search button to perform the autofilter action</p>
  
  <pre><code>Private Sub CommandButton1_Click() 'Search button
      Dim rData  As Range
  
      With Sheet1
  
          Set rData = .Range(.Cells(1, 1), .Cells(.Rows.Count, 8).End(xlUp))
  
          If Not .AutoFilterMode Then .Cells(1, 1).AutoFilter
          .Cells(1, 1).AutoFilter Field:=lFld, Criteria1:=sCrit            
          'Header
          On Error Resume Next
          Set rSource = .AutoFilter.Range.SpecialCells(xlCellTypeVisible)
  
          ActiveSheet.AutoFilterMode = False
  
          On Error GoTo 0
          .Cells(1, 200).CurrentRegion.ClearContents
          rSource.Copy .Cells(1, 200)
  
          Set rSource = .Cells(2, 200).CurrentRegion
          Set rSource = rSource.Offset(1, 0).Resize(rSource.Rows.Count - 1, _
                                                    rSource.Columns.Count)
      End With
  
      With Me.ListBox1
          .RowSource = ""
          .RowSource = rSource.Address(external:=True)
      End With
  
  End Sub
  </code></pre>
  
  <p>They work perfectly if I autofilter them at a field and a criteria one at a time. 
  Now my question is how can I autofilter the optionbutton and then continue and filter the data for combobox?</p>
  
  <p>Edited: my listbox does not seem to update accordingly with the excel after search 2. How can I amend my code such that it will refresh from the first search and list out the updated search 2 result? Please advise.</p>