title: Is it possible to fill an array with row numbers which match a certain criteria without looping?
body: <p>I would like to fill an array in VBA with the row numbers of only rows which meet a certain criteria. I would like the fastest method possible (for example, something like <code>RowArray = index(valRange=valMatch).row</code>)</p>
  
  <p>Below is the code for the (slow) range loop. </p>
  
  <p><strong><code>Current Code</code></strong></p>
  
  <pre><code>Sub get_row_numbers()
  
  Dim RowArray() As Long
  Dim valRange As Range
  Dim valMatch As String
  
  Set valRange = ActiveSheet.Range("A1:A11")
  valMatch = "aa"
  ReDim RowArray(WorksheetFunction.CountIf(valRange, valMatch) - 1)
  
  For Each c In valRange
      If c.Value = valMatch Then RowArray(x) = c.Row: x = x + 1
  Next c    
  End Sub
  </code></pre>