title: How do I autofilter using an array for criteria
body: <p>I am just learning about using arrays and am a bit stuck on how to use arrays as an input for criteria in autofiltering. I would like to set an array with values and then filter an excel spreadsheet using those same values. I did the below code, but it keeps throwing up an error when I try to autofilter</p>
  
  <p><strong>Here is my code</strong> </p>
  
  <pre><code>Dim I As Integer
  ReDim arr(1 to var) As Variant 'var is defined in a different function with a #
  I = 1
  For Each rngValue In rngValues.cells 'rngValues is defined in a different function
      If rngValue ="c" then
         arr(I)=rngValue.Offset(0,2)
      End If
      I = I +1
  Next rngValue
  
  arr(I) = "="
  
  With ws1
      .[A1].Autofilter Field:=1, Criteria1:=arr, operator:xlfiltervalues
  End With
  </code></pre>