Hi John That depends as there are many ways of doing a loop. For example: a) In the example supplied, I use a For...Next loop and the Next line will increment the counter. Perhaps more obvious if instead I had written it as Next i b) Using Do Until i = 2 ....Loop, I would start with i=0 before the loop and would need to include i=i+1 in the loop as that doesn't increment automatically Similarly with While...Wend c) When looping through a recordset, you would use i=i+1 before the .Next line
Hi Colin, I noticed that in your loop, there is no "i = i + 1" Have I been adding unnecessary code all this years?
Hi John
That depends as there are many ways of doing a loop. For example:
a) In the example supplied, I use a For...Next loop and the Next line will increment the counter. Perhaps more obvious if instead I had written it as Next i
b) Using Do Until i = 2 ....Loop, I would start with i=0 before the loop and would need to include i=i+1 in the loop as that doesn't increment automatically
Similarly with While...Wend
c) When looping through a recordset, you would use i=i+1 before the .Next line
Thanks Colin, always good to learn something new.