ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   jump into the loop (https://www.excelbanter.com/excel-programming/393508-jump-into-loop.html)

tony

jump into the loop
 
Is it possible to jump into the loop ?

I have the module with two nested For ... Next loops:

For i = 1 to 6
....
For j = 1 to 10
...
Next j
Next i

Is it possible to store the values of i and j, close workbook and on reopen
jump inside the second loop to the place when it was finished, i.e. with i =
3 and j = 7 and to continue what was interupted before closing ? I think it
is not possible, when next is reached before seeing For first it is giving
error message, but maybe I am wrong, maybe it can be done ????

Regards,

Tony


Peter T

jump into the loop
 
iFrom = 3
jFrom = 7

For i = iFrom To 6

For j = jFrom To 10

Next j
Next i

Regards,
Peter T

"Tony" wrote in message
...
Is it possible to jump into the loop ?

I have the module with two nested For ... Next loops:

For i = 1 to 6
...
For j = 1 to 10
...
Next j
Next i

Is it possible to store the values of i and j, close workbook and on

reopen
jump inside the second loop to the place when it was finished, i.e. with i

=
3 and j = 7 and to continue what was interupted before closing ? I think

it
is not possible, when next is reached before seeing For first it is giving
error message, but maybe I am wrong, maybe it can be done ????

Regards,

Tony




Charlie

jump into the loop
 
Don't forget to reset jFrom to 1 after the initial loop:

iFrom = 3
jFrom = 7

For i = iFrom To 6

For j = jFrom To 10

Next j

jFrom = 1

Next i

"Peter T" wrote:

iFrom = 3
jFrom = 7

For i = iFrom To 6

For j = jFrom To 10

Next j
Next i

Regards,
Peter T

"Tony" wrote in message
...
Is it possible to jump into the loop ?

I have the module with two nested For ... Next loops:

For i = 1 to 6
...
For j = 1 to 10
...
Next j
Next i

Is it possible to store the values of i and j, close workbook and on

reopen
jump inside the second loop to the place when it was finished, i.e. with i

=
3 and j = 7 and to continue what was interupted before closing ? I think

it
is not possible, when next is reached before seeing For first it is giving
error message, but maybe I am wrong, maybe it can be done ????

Regards,

Tony






All times are GMT +1. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com