Results 1 to 3 of 3

Thread: simple loop question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 1999
    Posts
    309

    simple loop question

    I am looking for a command that let's me jump on to the next iteration of the loop. Exit loop is not good cause this escapes from the entire loop altogether...

    It's probably very easy, but I just lost it...

  2. #2
    nullus
    Guest
    the only way i know is to use the GoTo statement

    VB Code:
    1. For i = 1 To 10
    2.   If (i = 5) Then
    3.     GoTo NextLoop
    4.   End If
    5.  
    6.   Debug.Print i
    7. NextLoop:
    8. Next i

    not very good practice to use GoTo's though

  3. #3
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    This would be ok
    VB Code:
    1. For i = 1 To 10
    2.   If (i = 5) Then
    3.     i = i + 1
    4.   End If
    5.   Debug.Print i
    6. Next i

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width