+ Reply to Thread
Results 1 to 3 of 3

Error Handler for Run-time error '9'

Hybrid View

josnah Error Handler for Run-time... 11-07-2006, 12:52 PM
Carim Hi, I am sure you know the... 11-07-2006, 12:58 PM
josnah Re: Error Handler for... 11-07-2006, 01:17 PM
  1. #1
    Registered User
    Join Date
    02-19-2004
    Posts
    57

    Lightbulb Error Handler for Run-time error '9'

    I have a macro which works on a specific worksheet in a shared file.

    Say the worksheet has been renamed from Test to something else by another user........
    How can I set a Msg box to appear instead of the MIcrosoft VB dialog box displaying the following msg?

    Run-time error '9'
    Subscript out of range


    I have tried the following using my trial & error method:

    Sub Test()

    On Error Got to ErrHandler1
    Sheets("Test").Select

    Exit Sub

    ErrHandler1:
    MsgBox "The Test worksheet is not found. Unable to proceed!"
    Exit Sub

    End Sub

    Pls help!

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    I am sure you know the combination of macros with shared files is quite complex ...
    A macro can properly run in a shared file if the macro was saved before the worksheet became shared ...
    With the problem you are describing, you should either instruct your users or pre-program the impossibility to change worksheet name ...

    HTH
    Carim

  3. #3
    Registered User
    Join Date
    02-19-2004
    Posts
    57

    Smile Re: Error Handler for Run-time error '9'

    actually i meant that the file is being shared in a network folder. It can only be opened as Read-only to prevent modifications to the original file. but some actually save it in another location & make changes to the worksheet names. The macro then does not work.
    The feature Workbook Sharing was not used.... Apologies for causing the confusion.

    instruct the users? there are some stubborn people in my office so that just doesn't work!
    pre-programming the impossibility to change worksheet name sounds interesting but how do i do it?

    Anyways, anyone out there who can help me with the Msgbox macro

    Thks!
    Josnah

+ 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