+ Reply to Thread
Results 1 to 3 of 3

ending a sub FOR loop in a main FOR loop

  1. #1
    Registered User
    Join Date
    08-10-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    34

    ending a sub FOR loop in a main FOR loop

    Hi guys,
    I have written a program in word(2003) vba which consists of a main FOR loop and within it consists a small sub(just calling it sub because its within the main FOR loop) FOR loop.
    Now, I would like to know:
    1) when the conditions are satisfied in the sub FOR loop, how can i end this sub FOR loop?
    2) After the sub FOR loop ends, I want the main FOR loop to skip to the next loop, without running the codes in between.
    Example :
    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: ending a sub FOR loop in a main FOR loop

    Hi Samkumar,

    You can use goto statement for your requirement.
    Please Login or Register  to view this content.
    Regards,
    Sindhu

  3. #3
    Registered User
    Join Date
    08-10-2012
    Location
    germany
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: ending a sub FOR loop in a main FOR loop

    Thank you so much Sindhu. It works!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1