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

Thread: Run time error

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    45
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I am still getting my feet wet with VBA. What can I do to debug the code when I get "Run-time error '9', Subscript out of range". I have VeryUnHide a worksheet and U use ctrl+k to shortcut to unhide it when I log in. Has worked perfect up to today. Any help would be greatly appreciated.

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi CHuguley,

    It is always helpful when posting run-time problems to show the line of code where the problem occurs. You can find this out by clicking the Debug button on the error message dialog box.

    From what information you have provided my guess is that the problem is occurring on a line of code that looks like:

    Sheets("some sheet").Visible = True

    and that the problem is occurring because no such sheet exists with that name. I would recommend that you look very carefully at the name of the sheet in the VBE project pane, paying particular attention to blanks. Even leading and trailing blanks in the sheet name must be matched exactly by the text strin used in the Sheets() or Worksheets() references. If you don't see the sheet in the VBE project pane then you have accidentally deleted the sheet and that is why the code can't find it.

    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    Just an abgle.. as you say OK until today , any alterations to code or the data that script looks at, nothing added amanded or deleted that could make the script trip. ill look up run 9 asap!


    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

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
  •