+ Reply to Thread
Results 1 to 7 of 7

do - loop until won't stop going back to beginning

  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    do - loop until won't stop going back to beginning

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,927

    Re: do - loop until won't stop going back to beginning

    All those "GoTo" 's are a problem; you didn't post the entire code.

    To Attach a Workbook:
    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit
    Ben Van Johnson

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: do - loop until won't stop going back to beginning

    Hello Dabbler39
    ,
    Welcome to the Forum!

    When using the FindNext method of a Range, there are 2 conditions you must check for to terminate the Do loop. First is the Range found something. This is confirmed by testing if the Range is equal to the special object value Nothing. Second is to compare the address is not equal to the address of the first match.

    You have done the latter (test the address) but not the former (test for Nothing). The last coupe of lines should be...
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    Re: do - loop until won't stop going back to beginning

    Thank you Proton. I am at work now, so can not access my files. However, I am probably going to try Leith's suggestion first. I am curious, however, as to what you see as a problem with the goto's. My goto's are working fine and my code works fine with the exception of the aforementioned issue. That being said, are you suggesting a better way of peeling the apple with the goto's? As I am a newb, I am always open to suggestions!!! If we're not learning, we're dead. I will upload my file when I get home tonight. Thank you for your help.

  5. #5
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    Re: do - loop until won't stop going back to beginning

    I was unable to upload the excel workbook due to it's size (forum prohibited). As such, I have inserted the entire code for this particular userform.

  6. #6
    Registered User
    Join Date
    12-03-2012
    Location
    Omaha, Nebraska
    MS-Off Ver
    2010
    Posts
    39

    Re: do - loop until won't stop going back to beginning

    I was unable to insert the entire code, but i cut out the section that fails. What's interesting is that the other section is a mirror of this code and works perfectly. It exits the do loop properly. Thanks all. P.S. I tried Leith's suggestion to no avail.

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,927

    Re: do - loop until won't stop going back to beginning

    Without the whole code the below is only an example to eliminate the goto's.

    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