Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Error Handling problem Excel 2013

    For some reason the error handing in a macro enabled workbook is not picking up when there is an error and dealing with it using an error handling code.
    The lines are>

    On Error GoTo err_Assignments
    Worksheets("ASSIGNMENTS").Activate

    Because the ASSIGNMENTS worksheet does not exist then I should be trapping this error and seeing a separate message to say the error has occurred

    The error handling is for now
    err_Assignments:
    MsgBox Err.Number & " - " & Err.Description


    It doesn't catch the error and it throws the Run-time error '9':
    Subscript out of range

    I tried on error resume next but still the runtime error is being displayed

    Have I missed a new setting in 2013?

    thanks
    alan

  2. #2
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Sorted

    Darn it - simple settings check would have resolved this...apologies.

    Tools>Options>General> make sure error trapping is set as 'Break on Unhandled Errors'

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,832
    Thanks
    136
    Thanked 484 Times in 461 Posts
    Hi

    In the VBA editor, it would be better to use..
    Tools>Options>General> make sure error trapping is set as 'Break In Class Module'

    The reason is that if an error occurred in say, a Userform's vba code, then the debugger will stop at the relevant line of code that caused the problem in the Userform's code.

    zeddy

Posting Permissions

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