title: (Excel VBA) loop through range with while or for?
body: <p>Recently I was pointed out that some Excel functions are volatile, meaning they are triggered every time there is a change in the worksheet, while others aren't. Now this brings me to the point that most of my VBA usage is looping through a range and I am wondering which of the two methods is to be preferred and why? 
  Case do while-loop; </p>
  
  <pre><code>Dim i as long
  i = 1
  Do while cells(i,1) &lt;&gt; ""
      ...
      i = i + 1
  Loop
  </code></pre>
  
  <p>Or for-loop</p>
  
  <pre><code>Dim curCell as cell
  for curCell = cells(1,1) to cells(1,1).end(xlDown)
      ...
  Next curCell
  </code></pre>
  
  <p>(please note that the exact code might be incorrect since I currently don't have access to a computer with Excel)</p>
  
  <p>Edit (after John's remark); As far as I can see in the first example the target cell value is requested every time the loop is looped, in the second example the cell will only be requested twice ánd .end(xlDown) does not require the vba layer but is a standard function thus the second option might be running faster. </p>
  
  <p>Thanks in advance</p>