Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a For Next Loop. I want to publically define a variable that updates
in another module that increments (1,2,3,4,5 etc). In the loop below I want to be able to test this public variable to see if it has reached a defined limit (say 35,0000). When it does, I want to be able to increment the loop to the next X value. I know I can Exit the loop with "Exit For". But how do I increment it (i.e. what Next would do) based on my IF value being true without running the code under the IF statement? For X = 1 to 10 If PublicVariableCounter = 30,000 Then [increment X to next value] Call other modules Next Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi ExcelMonkey,
Maybe I'm misunderstanding your question, but can't you do something like this: For X = 1 to 10 If PublicVariableCounter < 30,000 Then 'Call other modules End If Next -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] ExcelMonkey wrote: I have a For Next Loop. I want to publically define a variable that updates in another module that increments (1,2,3,4,5 etc). In the loop below I want to be able to test this public variable to see if it has reached a defined limit (say 35,0000). When it does, I want to be able to increment the loop to the next X value. I know I can Exit the loop with "Exit For". But how do I increment it (i.e. what Next would do) based on my IF value being true without running the code under the IF statement? For X = 1 to 10 If PublicVariableCounter = 30,000 Then [increment X to next value] Call other modules Next Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
for loop with if statement | Excel Worksheet Functions | |||
If statement - Loop? | Excel Discussion (Misc queries) | |||
continue statement in a loop | Excel Programming | |||
Boolean to advance loop | Excel Programming | |||
Do Until loop with if statement | Excel Programming |