title: vba - Looping through the rows count and saving the value to variable
body: <p>how can the pretty much the same codes could result in diferrent outputs?</p>
  
  <p>This code:</p>
  
  <pre><code>Sub test()
    i = 1
      For d = 1 To 4
        i = i + 1
        Debug.Print i
      Next d
  End Sub
  </code></pre>
  
  <p>prints <br> 
   2 <br> 
   3 <br> 
   4 <br> 
   5 </p>
  
  <p>which is perfect, but this one</p>
  
  <pre><code>Sub test2()
    rcount = 34
      For d = 1 To 4
       rcount = Sheets("sheettest").Range(Range("A" &amp; rcount + 4), Range("B" &amp; rcount + 4).End(xlDown)).Offset(3, 0).Rows.Count
      Debug.Print rcount
      Next d
  End sub
  </code></pre>
  
  <p>prints <br> 
   203<br> 
   34 <br> 
   203 <br> 
   34 </p>
  
  <p>which is not what I expect</p>
  
  <p>why the second value is 34 again?</p>