title: Store a Row Range/List
body: <ol>
  <li><p>Trying to create a row range/list that stores all the row numbers with values in column A.<br />
  When I run the code I get the last VarRow() -&gt; last row number instead of the entire range/list.</p>
  </li>
  <li><p>Many times, I could not run through <code>VarRow(VarCount) = z + 1</code>.<br />
  It stops at the row when the cell has the value so I cannot finish going to the next line of code (shows Subscript out of range).</p>
  </li>
  </ol>
  <pre class="lang-vb prettyprint-override"><code>Dim VarRow() As Double
  
  VarCount = 0
  VarCount2 = 0
  
  For z = 1 To 350
      If Range(&quot;A1&quot;).Offset(z, 0).Value &lt;&gt; 0 Then
          VarCount = VarCount + 1
      End If
  Next z
                       
  ReDim Preserve VarRow(VaCount2)
                      
  For z = 1 To 350
      If Range(&quot;A1&quot;).Offset(z, 0).Value &lt;&gt; 0 Then
          VarCount2 = VarCount2 + 1
          VarRow(VarCount) = z + 1
      End If
  Next z
  </code></pre>