How to Advance a For Next Loop prior to the Next Statement

G

Guest

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
 
J

Jake Marx

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top