+ Reply to Thread
Results 1 to 4 of 4

Deal With Recursive (Endless Loop)

  1. #1
    Registered User
    Join Date
    04-22-2013
    Location
    Ankara
    MS-Off Ver
    Excel 2007
    Posts
    30

    Question Deal With Recursive (Endless Loop)

    Hi all,

    I have a VBA code to find largest value according to the capacity comparison. But if the result of comparison does not get "true", I have to stop the for loop of "k"
    and make it start at the beginning of for loop of j.

    Please Login or Register  to view this content.
    If I call another macro as a result of false, then I have recursive VBA.

    Please Login or Register  to view this content.

    What should I do to deal with this problem?

    Thanks in advance,
    Oxco

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Deal With Recursive (Endless Loop)

    Have you tried putting "Exit for" after the line "EstMax = -1"?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    04-22-2013
    Location
    Ankara
    MS-Off Ver
    Excel 2007
    Posts
    30

    Re: Deal With Recursive (Endless Loop)

    Yes, but it does not work! =(

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Deal With Recursive (Endless Loop)

    There are a couple of things I don't follow.

    The blue code below doesn't change any values for each j loop, so nothing changes in the k loop. So if you were to exit k and reset to j=2, what would be different?. You don't use the value of j anywhere within its loop.

    Also, the red code doesn't seem correct. k = (Row - 7 + a) evaluates to True or False which is a 1 or 0. Is that what you want?

    I can't tell you what to fix because I don't follow what it is suppose to do?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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