title: Filter using array and xlFilterValues
body: <p>I have written a code which defines an array and then uses that array as criteria to filter a range. Here's the extract of the code. Somehow it filters out everything and does not display the filtered values.</p>
  
  <pre><code>Dim N As Long
  
  Sheets("Calculations").Select
  
  With Sheets("Calculations")
          N = .Cells(Rows.Count, "A").End(xlUp).Row
          ReDim ary(1 To N)
          For i = 1 To N
              ary(i) = .Cells(i, 1)
          Next i
  End With
  
      Sheets("Data").Select
      Range(Range("A1"), Range("A1").End(xlToRight)).Select
      Range(Selection, Selection.End(xlDown)).Select
  
      With Selection
          .AutoFilter Field:=36, Criteria1:=ary, Operator:=xlFilterValues
      End With
  </code></pre>