Starting with test data:

And running the code:
Sub TestLoop()
Dim LastRow As Long, CurRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For CurRow = 1 To LastRow
Range("B" & CurRow).Value = "Done"
LastRow = 2
Next CurRow
End Sub
I would expect the Loop to end at Row 2 because I changed the variable LastRow. However the result is:

The MSDN Reference FOR VB.NET has this to say:
When a
For...Nextloop starts, Visual Basic evaluatesstart,end, andstep. Visual Basic evaluates these values only at this time and then assignsstarttocounter. Before the statement block runs, Visual Basic comparescountertoend. Ifcounteris already larger than theendvalue (or smaller ifstepis negative), theFor loopends and control passes to the statement that follows theNextstatement. Otherwise, the statement block runs.Each time Visual Basic encounters the
Nextstatement, it incrementscounterbystepand returns to theForstatement. Again it comparescountertoend, and again it either runs the block or exits the loop, depending on the result. This process continues untilcounterpassesendor anExit Forstatement is encountered. [Emphasis mine]
Given that it checks the counter against the end every iteration, shouldn't changing the variable change the end?
I'd like to note a few things here. First, you're referencing the VB.Net documentation. So, I wouldn't rely on that when talking about VBA. In fact, the VBA Documentation for the For...Next statement doesn't mention this behavior at all. So, I dug a little deeper and VBA does indeed behave the same as VB.Net here. The following is from the [MS-VBAL]: VBA Language Specification.
The expressions
<start-value>,<end-value>, and<step-increment>are evaluated once, in order, and prior to any of the following computations.
This means that LastRow in your example is only calculated when first entering the loop. Changing it afterward has no effect on the number of times the loop will run. (Not that I advise trying to do that to begin with.)
This also means that you can not change the size of the steps the loop takes mid-execution as well and this snippet shows the "odd" behavior of both of these at once.
Sub TestLoop()
Dim LastRow As Long, CurRow As Long, StepsToTake As Integer
LastRow = 100
StepsToTake = 2
For CurRow = 1 To LastRow Step StepsToTake
Range("B" & CurRow).Value = "Done"
LastRow = 2
StepsToTake = 1
Next CurRow
End Sub
For those interested, here are the entire runtime semantics of the For...Next statement.
Runtime Semantics.
The expressions
<start-value>,<end-value>, and<step-increment>are evaluated once, in order, and prior to any of the following computations. If the value of<start-value>,<end-value>, and<step-increment>are not Let-coercible to Double, error 13 (Type mismatch) is raised immediately. Otherwise, proceed with the following algorithm using the original, uncoerced values.Execution of the
<for-statement>proceeds according to the following algorithm:
If the data value of
<step-increment>is zero or a positive number, and the value of<bound-variable-expression>is greater than the value of<end-value>, then execution of the<forstatement>immediately completes; otherwise, advance to Step 2.If the data value of
<step-increment>is a negative number, and the value of<bound-variable-expression>is less than the value of<end-value>, execution of the<for-statement>immediately completes; otherwise, advance to Step 3.The
<statement-block>is executed. If a<nested-for-statement>is present, it is then executed. Finally, the value of<bound-variable-expression>is added to the value of<step-increment>and Let-assigned back to<bound-variable-expression>. Execution then repeats at step 1.If a
<goto-statement>defined outside the<for-statement>causes a<statement>within<statement-block>to be executed, the expressions<start-value>,<end-value>, and<step-increment>are not evaluated. If execution of the<statement-block>completes and reaches the end of the<statement-block>without having evaluated<start-value>,<end-value>and<step-increment>during this execution of the enclosing procedure, an error is generated (number 92, "For loop not initialized"). This occurs even if contains an assignment expression that initializes<bound-variable-expression>explicitly. Otherwise, if the expressions<start-value>,<end-value>, and<step-increment>have already been evaluated, the algorithm continues at Step 3 according to the rules defined for execution of a<for-statement>.When the
<for-statement>has finished executing, the value of<bound-variable-expression>remains at the value it held as of the loop completion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With