View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ExcelMonkey ExcelMonkey is offline
external usenet poster
 
Posts: 553
Default How to Advance a For Next Loop prior to the Next Statement

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