LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default How to Advance a For Next Loop prior to the Next Statement

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


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
for loop with if statement Steve Excel Worksheet Functions 1 February 17th 10 07:56 PM
If statement - Loop? George Excel Discussion (Misc queries) 1 March 14th 06 07:06 AM
continue statement in a loop rozner Excel Programming 4 August 2nd 05 03:30 PM
Boolean to advance loop ExcelMonkey[_190_] Excel Programming 1 March 14th 05 06:41 PM
Do Until loop with if statement Sandy[_3_] Excel Programming 4 July 17th 03 11:06 AM


All times are GMT +1. The time now is 12:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"