title: VBA Populate an array one value at a time
body: <p>I want to put some code together that runs through each cell in a column and if a condition is met place it into the next available array element. I have the first part but I don't know how to place each element that meets the IF statement criteria into an array and then transpose that array.</p>
  <pre><code>Option Explicit
  Private Sub Workbook_Open()
  
  Dim StepCheck As Range
  Dim ImporterName As Variant
  Dim ws As Worksheet
  Dim NameRange As Range
  
  
  
  Set ws = Workbooks.Open(Filename:=&quot;Filepath goes here&quot;).Sheets(&quot;Sheet1&quot;)
  
  
  For Each StepCheck In ws.Range(&quot;F1:F&quot; &amp; ws.Cells(ws.Rows.Count, &quot;F&quot;).End(xlUp).Row)
  
  If IsError(StepCheck.Value) Then
      If Err.Number &lt;&gt; 0 Then
          Err.Clear
          On Error GoTo 0
          End If
          
      ElseIf StepCheck.Value = &quot;5&quot; Then
  
      ImporterName = StepCheck.Offset(0, -5).Value
      
  End If
  Next
  
  
  End Sub
  </code></pre>
  <p>How do I store every StepCheck when it meets the IF statement criteria into the array importer name?</p>
  <p>Currently I have to say the code works fine but doesn't store all of the StepCheck entries into the array and instead gets overwritten every loop.</p>