Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Increment variable not incrementing?
I have a series of loops that utilize the same set of variables
as integer increments... For i = 1 to 100 For j = 1 to 200 .. .. .. Next j Next i For i = 1 to 500 .. .. .. The odd thing is that when it hits the subsequent use of the variable in next set of for/next loops, the variable is not resetting to the value called for in the loop. What I see happening is that its starting off at 1+ the top value of the prior loop. So in this instance, it would start at 101 and go to 500. Thoughts? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Increment variable not incrementing?
Actually - its worse than I thought -
Now when I "watch" the process - its plowing right through the For-Next loops without looping at all. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Increment variable not incrementing?
This works, need to change numbers
Sub Macro7() For i = 1 To 2 For j = 1 To 2 Stop Next j Stop Next i End Sub " wrote: I have a series of loops that utilize the same set of variables as integer increments... For i = 1 to 100 For j = 1 to 200 .. .. .. Next j Next i For i = 1 to 500 .. .. .. The odd thing is that when it hits the subsequent use of the variable in next set of for/next loops, the variable is not resetting to the value called for in the loop. What I see happening is that its starting off at 1+ the top value of the prior loop. So in this instance, it would start at 101 and go to 500. Thoughts? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Increment variable not incrementing?
Actually, it was a much different problem.
What I discovered was that I had dim'd the counters as Integers, but on one occasion, it just happened the upper bound of the 2nd use of the counter happened to be larger than 32,767 (the upper limit of an integer) and so the code was just pushing through the For Next loop ignoring the For and the Next. Once I changed the Integer statement to Long, it worked fine. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
incrementing | Excel Worksheet Functions | |||
Variable Incrementing | Excel Discussion (Misc queries) | |||
Increment a Variable Defined Date by 1 day | Excel Programming | |||
Increment a variable | Excel Programming | |||
Increment a variable while looping | Excel Programming |