Results 1 to 22 of 22

Thread: [RESOLVED] Exit one level up nested For...Next

Threaded View

  1. #1

    Thread Starter
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    Resolved [RESOLVED] Exit one level up nested For...Next

    Hi Guys!

    I am pretty sure it is impossible but I want to ask it, anyway:
    I have
    Code:
    For n = 0 To 5 'The values are not important.
    For m = 1 To 6 'The values are not important.
    .
    .'Do Something
    .
    Next m
    'Do some other stuff
    Next n
    I want to go to Next n if something happens in For..m..Next
    Code:
    For n = 0 To 5 'The values are not important.
    For m = 1 To 6 'The values are not important.
    .
    If something happens Then
    Next n 'Here is the impossible part.
    End If
    .
    Next m
    'Do some other stuff
    Next n
    My solution is
    Code:
    For n = 0 To 5 'The values are not important.
    For m = 1 To 6 'The values are not important.
    .
    If something happens Then
    GoTo Skip
    End If
    .
    Next m
    'Do some other stuff
    Skip:
    Next n
    But I am looking for something better because I am not sure if GoTo slows my code or not.

    Any idea?
    Thanks a lot!
    Last edited by Flashbond; Feb 22nd, 2013 at 09:31 PM.

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