
Chapter 12 More VBA Programming278
In this case, the condition will be tested at the end of the loop. The result, however, will
be the same: cells A1:D1 will be filled with 1 to 4, respectively. Suppose the statement
I = 1 is replaced with I = 5 in both of the previous code segments. In that case,
the loop in the first case with the condition testing at the beginning will not execute
at all. On the other hand, the second loop will execute once setting cell E1 equal to 1.
So when you use the Do While structure you should remain aware of where you place the
condition checking.
Do Until Looping
The Do Until looping structure bears a close resemb ...