title: Delete rows that not contain string in my array
body: <p>Pls help me modify this code but I would like to keep it 90% the same.</p>
  
  <p>I want to delete the rows that does not contain the array items. So my program deletes rows with a, b in cell. How can I modify the below code so that it erases the other a, b to remain in exec.</p>
  
  <pre><code>myArr = Array("a","b")
  For I = LBound(myArr) To UBound(myArr)
  
      'Sheet with the data, you can also use Sheets("MySheet")
      With ActiveSheet
  
          'Firstly, remove the AutoFilter
          .AutoFilterMode = False
  
          'Apply the filter
          .Range("E1:E" &amp; .Rows.Count).AutoFilter Field:=1, Criteria1:=myArr(I)
  
          Set rng = Nothing
          With .AutoFilter.Range
              On Error Resume Next
              Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
                        .SpecialCells(xlCellTypeVisible)
              On Error GoTo 0
              If Not rng Is Nothing Then rng.EntireRow.Delete
          End With
  
          'Remove the AutoFilter
          .AutoFilterMode = False
      End With
  Next I
  </code></pre>