F-150 Phill
New Member
- Joined
- May 19, 2011
- Messages
- 17
I've been searching for an answer to this for some time but the keywords always bring back the wrong results
.
I'm trying to run a simple for loop but when it starts running it starts with the "to" value
.
i.e.
For A = Top to Bottom
do something
Next A
In this example, lets say "Top" = 5 and "Bottom" = 20, on the first run of the loop it will start with the 20 and count up from there (A=20, A=21, A=22 etc). "Top" and "Bottom" are variables with the values set earlier in the macro and the "Top" value is always smaller than the "Bottom" value.
If I write the loop like this instead:
For A = Bottom to Top
do something
Next A
where "Top" is still 5 and "Bottom" is still 20, it will start with the value for "Top" and count on (A=5, A=6 etc).
It doesn't work this way for all my loops (there are multiple in this macro), only this one, and this has happened before. What am I doing wrong? Am I using variables that are preprogrammed to do other things? I'm beating my head against the wall trying to figure it out!

I'm trying to run a simple for loop but when it starts running it starts with the "to" value

i.e.
For A = Top to Bottom
do something
Next A
In this example, lets say "Top" = 5 and "Bottom" = 20, on the first run of the loop it will start with the 20 and count up from there (A=20, A=21, A=22 etc). "Top" and "Bottom" are variables with the values set earlier in the macro and the "Top" value is always smaller than the "Bottom" value.
If I write the loop like this instead:
For A = Bottom to Top
do something
Next A
where "Top" is still 5 and "Bottom" is still 20, it will start with the value for "Top" and count on (A=5, A=6 etc).
It doesn't work this way for all my loops (there are multiple in this macro), only this one, and this has happened before. What am I doing wrong? Am I using variables that are preprogrammed to do other things? I'm beating my head against the wall trying to figure it out!
