From: Luke on 19 Feb 2010 15:45 There's a thought. I'm learning that it is sometimes easier to accomplish what you want if you test for the opposite of what you want. Thanks. "Ryan H" wrote: > Correction. > > For x = 1 to 11 > If condition = False then > ' do something > End if > Next x > > -- > Cheers, > Ryan > > > "Luke" wrote: > > > I have a for-next loop, within which I want to check to see if a certain > > condition is true. If it is true, I want to skip the rest that particular > > iteration and move on to the next one in the loop. I tried code that looked > > like the following, but it just gave me a "next without for" error: > > > > For x = 1 to 11 > > If condition = true then > > next x > > End if > > Next x > > > > I want to do this without using a GoTo statement. Any suggestions?
From: Jef Gorbach on 19 Feb 2010 21:25 On Feb 19, 3:45 pm, Luke <L...(a)discussions.microsoft.com> wrote: > There's a thought. I'm learning that it is sometimes easier to accomplish > what you want if you test for the opposite of what you want. Thanks. > > > > "Ryan H" wrote: > > Correction. > > > For x = 1 to 11 > > If condition = False then > > ' do something > > End if > > Next x > > > -- > > Cheers, > > Ryan > > > "Luke" wrote: > > > > I have a for-next loop, within which I want to check to see if a certain > > > condition is true. If it is true, I want to skip the rest that particular > > > iteration and move on to the next one in the loop. I tried code that looked > > > like the following, but it just gave me a "next without for" error: > > > > For x = 1 to 11 > > > If condition = true then > > > next x > > > End if > > > Next x > > > > I want to do this without using a GoTo statement. Any suggestions? How about checking condition before the for .. next? Do While condition = True
First
|
Prev
|
Pages: 1 2 Prev: If And formular Or somthing else Next: Excel AddIn - how to get formula from Formula Dialog |