title: Excel VBA autofilter all but three
body: <p>In the continuing saga of my data analysis (<a href="https://stackoverflow.com/questions/19390732/method-range-of-object-worksheet-failed-naming-range-and-referring-to-it">First Question</a>), I want to delete all the rows whose departments (Field 7) are not 101, 102 or 103 (the names have been changed to protect the innocent). There are about a hundred departments in the data, so using <code>Criteria1:=Array("104", "105", "106",</code> etc is impractical.</p>
  
  <p>I would like to do something like this:</p>
  
  <pre><code>myrange.AutoFilter Field:=7, Criteria1:="&lt;&gt;101", Operator:=xlOr, _
      Criteria2:="&lt;&gt;102", Operator:=xlOr, Criteria3:="&lt;&gt;103"
  </code></pre>
  
  <p>but Excel doesn't recognize more than 2 Criteria. I could add a helper column, and have the macro run through each line (if 101, 102, or 103, then value=Yes), filter out the yeses, and delete all that remain, but I'm saving that as a last resort.</p>
  
  <p>Is there a way to Autofilter Criteria1 to be Not Equal To an array? Something like:</p>
  
  <pre><code>myrange.AutoFilter Field:=7, Criteria1:="&lt;&gt;" &amp; Array("101", "102", "103")
  </code></pre>