ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with For..Next Loop (https://www.excelbanter.com/excel-programming/372095-help-next-loop.html)

Dewey

Help with For..Next Loop
 
Hi,

I have a For Next loop that I want to skip to the next iteration given
a certain condition, does anyone know the syntax for this.

psuedo code:

For i = 1 to 2000

code...

if condition is true
"Code to loop to next i"
end if

more code...

next i 'normal loop point.


Any help would be greatly appreciated, Cheers

Dewey


moon[_6_]

Help with For..Next Loop
 

If condition = True Then
i = i + 1
End If


"Dewey" schreef in bericht
oups.com...
Hi,

I have a For Next loop that I want to skip to the next iteration given
a certain condition, does anyone know the syntax for this.

psuedo code:

For i = 1 to 2000

code...

if condition is true
"Code to loop to next i"
end if

more code...

next i 'normal loop point.


Any help would be greatly appreciated, Cheers

Dewey




DaveyJones

Help with For..Next Loop
 
For i = 1 To 2000

' Code

If '###Condition###' = 1 Then GoTo Nxtloop

' More Code processed if ###Condition### = 0

End If
Nxtloop:
Next
--
Dave


"Dewey" wrote:

Hi,

I have a For Next loop that I want to skip to the next iteration given
a certain condition, does anyone know the syntax for this.

psuedo code:

For i = 1 to 2000

code...

if condition is true
"Code to loop to next i"
end if

more code...

next i 'normal loop point.


Any help would be greatly appreciated, Cheers

Dewey



Bob Phillips

Help with For..Next Loop
 
Just increment the index by 1 on that condition.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Dewey" wrote in message
oups.com...
Hi,

I have a For Next loop that I want to skip to the next iteration given
a certain condition, does anyone know the syntax for this.

psuedo code:

For i = 1 to 2000

code...

if condition is true
"Code to loop to next i"
end if

more code...

next i 'normal loop point.


Any help would be greatly appreciated, Cheers

Dewey




Dewey

Help with For..Next Loop
 
Thanks Dave, thats exactly what I was looking for. I knew there had to
be a syntax for it.

Cheers



DaveyJones wrote:

For i = 1 To 2000

' Code

If '###Condition###' = 1 Then GoTo Nxtloop

' More Code processed if ###Condition### = 0

End If
Nxtloop:
Next
--
Dave


"Dewey" wrote:

Hi,

I have a For Next loop that I want to skip to the next iteration given
a certain condition, does anyone know the syntax for this.

psuedo code:

For i = 1 to 2000

code...

if condition is true
"Code to loop to next i"
end if

more code...

next i 'normal loop point.


Any help would be greatly appreciated, Cheers

Dewey





All times are GMT +1. The time now is 10:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com