+ Reply to Thread
Results 1 to 7 of 7

Program appears to loop endlessly, have to force quit

  1. #1
    Registered User
    Join Date
    11-11-2009
    Location
    Columbus, Ohio; USA
    MS-Off Ver
    Excel 2002
    Posts
    70

    Red face Program appears to loop endlessly, have to force quit

    Sorry! Forgot the code!!!

    Here's the code I am using. It worked before.
    I added in the section you see in it for clearing the formatting.

    I don't believe that I tweaked it to cause what is happening,
    but now when I run the program (from a button I made),
    the excel screen flashes wildly and never seems to give the results.
    I even had it run in the background for awhile while I did work in another
    application, checking back on it periodically.

    Is there something in my code that looks like it could be causing such an
    endless loop?

    Thank you!

    Please Login or Register  to view this content.
    Last edited by Danexcel; 11-18-2009 at 11:00 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Program appears to loop endlessly, have to force quit

    Hi,

    You'll need to post the code of course

    Rgds
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-11-2009
    Location
    Columbus, Ohio; USA
    MS-Off Ver
    Excel 2002
    Posts
    70

    Re: Program appears to loop endlessly, have to force quit

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    You'll need to post the code of course

    Rgds
    Good catch! Thanks

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Program appears to loop endlessly, have to force quit

    You set rData to the usedrange of sheet Results, and then clear the usedrange, and then try to operate on rData, which is now cleared.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Program appears to loop endlessly, have to force quit

    Hi,

    First thought is where does Range("R5").End(xlDown) take you to? If row 65536 then you are looking at a lot of cells and maybe the macro is just chuntering through.

    The other instruction I'd look at is the Sheets("Results").UsedRange.Clear

    I've noticed in both xl2007 and xl2003 that on occasions this can take for ever. I've never fully buttoned it down but I think its associated with the system thinking the last cell in the used range is down on row 65536. You may think the last visible cell is the last cell, but sometimes if a format, or even a cell entry which is subsequently deleted is on the last row, this persists until you delete the extraneous rows/columns and perform a Save.

    HTH

  6. #6
    Registered User
    Join Date
    11-11-2009
    Location
    Columbus, Ohio; USA
    MS-Off Ver
    Excel 2002
    Posts
    70

    Re: Program appears to loop endlessly, have to force quit

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    First thought is where does Range("R5").End(xlDown) take you to? If row 65536 then you are looking at a lot of cells and maybe the macro is just chuntering through.

    The other instruction I'd look at is the Sheets("Results").UsedRange.Clear

    I've noticed in both xl2007 and xl2003 that on occasions this can take for ever. I've never fully buttoned it down but I think its associated with the system thinking the last cell in the used range is down on row 65536. You may think the last visible cell is the last cell, but sometimes if a format, or even a cell entry which is subsequently deleted is on the last row, this persists until you delete the extraneous rows/columns and perform a Save.

    HTH
    Thank you. Yes, I'd like it to only go down to row 604. I tried to simply replaced the word xlDown with "R604" but I guess that's not permitted.
    How do I tell the program to stop at 604?

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Program appears to loop endlessly, have to force quit

    Hi,

    Just use:

    Please Login or Register  to view this content.
    Rgds

+ 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