+ Reply to Thread
Results 1 to 4 of 4

Error 9: Subscript Out of Range

  1. #1
    Registered User
    Join Date
    10-02-2018
    Location
    West Palm Beach
    MS-Off Ver
    360
    Posts
    11

    Error 9: Subscript Out of Range

    Hello all,

    Here is the issue in point form:

    - at my job, we use excel to create a journal entry and up load it into SAP for posting
    - this is a journal entry file and if I add or delete a workbook tab that is either needed or not needed within the file, I get that famous
    Error 9: Subscript Out of Range error and this kills the file
    - I then have to grab another J/E file that works and delete the one with the error

    I would LOVE to know about VBA to fix this range error. I am sure it's a common error but I can't seem to correct it.
    I do know how to jump into a macro but that's about it.

    Helllp!


    Regards,
    Rich

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Error 9: Subscript Out of Range

    If the code refers to a sheet (tab), and you delete that, then you get the error. How to deal with that depends a lot on how you want to handle it. If it doesn't exist anymore, just ignore it? or is there a replacement to be used instead?... the options are quite long to list... it all depends on the requirements.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    10-02-2018
    Location
    West Palm Beach
    MS-Off Ver
    360
    Posts
    11

    Re: Error 9: Subscript Out of Range

    Hello and thank you for your reply,

    I am not sure what the code refers to as I have yet to learn how to read code.
    The tab deleted was no longer needed.

    When I delete or add a tab it obviously changes the range so I guess I need to know how to update the range.

    I can post to code here if interested I suppose.


    Regards,
    Rich

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Error 9: Subscript Out of Range

    The code would be a start...

    There are 2 parts to a range... the sheet, and the actual range. When no sheet is specified, it is assumed to be the active one.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA script error help: Run-time error'9': Subscript out of range.
    By TrinhNgocAnh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-20-2018, 05:34 AM
  2. [SOLVED] Run-time error '9': subscript out of range - error occurs on multiple computers except one
    By BrettE in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-06-2014, 11:19 PM
  3. Runtime Error - Subscript out of Range / Object Error
    By JHRice in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2012, 05:14 PM
  4. Defining Array - Runtime error 9, Subscript out of range error
    By MaartenW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2012, 07:32 AM
  5. Subscript out of range error - save copy error
    By bg18461 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2006, 11:53 AM
  6. [SOLVED] Type Mismatch error & subscript out of range error
    By Jeff Wright in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-14-2005, 03:06 PM

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