Help with For..Next Loop

D

Dewey

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
 
G

Guest

For i = 1 To 2000

' Code

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

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

End If
Nxtloop:
Next
 
B

Bob Phillips

Just increment the index by 1 on that condition.

--
HTH

Bob Phillips

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

Dewey

Thanks Dave, thats exactly what I was looking for. I knew there had to
be a syntax for it.

Cheers
 

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

Similar Threads

For-next loop question 6
Vlookup with multiple FOR condition 1
Next Loop 10
loop help 6
skip to next from if 1
[Q] For, Next - How to Speed Up 6
Loop don't work 1
short circuit for next; continue? 6

Top