Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: neverending loop

  1. #1
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Does anyone ever catch themselves in a loop that never ends and displays a msgbox. If so, are there any keystrokes to exit out that override the msgbox "ok".

    For example:
    do while [a1].value=[a1].value
    msgbox "I am stuck"
    loop

    Don't run the code, but is there a way to get out of the loop once it has started without Ctrl+Alt+Del?

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-09 13:05, Al Chara wrote:
    Does anyone ever catch themselves in a loop that never ends and displays a msgbox. If so, are there any keystrokes to exit out that override the msgbox "ok".
    Of course not!

    If I ever found myself in such a position then I would hit CTRL+Break (or Pause/Break whatever you want to call it). Not that I would ever generate such a situation for myself. Never!

    And I would never not save a workbook before testing such a macro and then CTRL+ALT+DEL to kill Excel and lose a day's work.
    _________________
    [b] Mark O'Brien

    [ This Message was edited by: Mark O'Brien on 2002-04-09 13:10 ]

  3. #3
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Al,

    I just ran the loop and broke out of it with

    Ctrl+Break
    (the key to the right of the scroll lock key)

    Excel97 on NT4

    Will check to see if you put an On Error Resume Next statement it will allow you to break out of the code.

    Regards,
    Jay

    Update: On Error Resume Next has no effect. Ctrl-Break interrupts the code.

    [ This Message was edited by: Jay Petrulis on 2002-04-09 13:12 ]

  4. #4
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Ctrl+Break, its so simple. I must have hit ctrl+every other key on the darn keyboard. Thanks guys. I could kick myself for everytime that I had lost hours of work, when I had accidently put <> instead of = or vice versa.

  5. #5
    Board Regular
    Join Date
    Mar 2006
    Posts
    74
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: neverending loop

    ctrl+break is not working for me! i have a messagebox up and anything i type in it keeps me stuck in the loop. whoops!

  6. #6
    Board Regular
    Join Date
    Mar 2006
    Posts
    74
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: neverending loop

    ok it worked. i don't know what i did but it broke. wooohoo!

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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