Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Stop Macro Execution

  1. #1
    Board Regular
    Join Date
    Nov 2003
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Stop Macro Execution

    Hi,

    Can anyone tell me how can I stop the VBA code from running totally, after I trap an error?

    e.g.
    Code:
    On Error Resume Next
    If Err.Number = 1004 then
      // code to quit the whole process and return to worksheet view
    End If

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Stop Macro Execution

    either

    Exit Sub

    or the more "drastic"

    End
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    Board Regular Davers's Avatar
    Join Date
    Sep 2002
    Location
    Michigan
    Posts
    1,165
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Stop Macro Execution

    Wouldn't something like:

    Code:
    On Error Resume Next 
    If Err.Number = 1004 then 
      Exit Sub
    End If
    Dave

    Edit: Sorry Juan, you beat me!!
    Using Windows XP with Office XP

  4. #4
    Board Regular
    Join Date
    Nov 2003
    Posts
    121
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Stop Macro Execution

    Thank you guys.

    End

    is what I am looking for.

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
  •