+ Reply to Thread
Results 1 to 7 of 7

Subscript out of Range ? Run time error 9

  1. #1
    Registered User
    Join Date
    11-23-2023
    Location
    Yorkshire, England
    MS-Off Ver
    Office 365
    Posts
    11

    Subscript out of Range ? Run time error 9

    Can anyone suggest why I get a subscript out of range error 9 ?

    My code is :
    Please Login or Register  to view this content.
    The macro is supposed to copy data in a Table on the IncidentsForm Tab, (Table currently has data in it from A3 to X17, table header is in row 2, and the table is called Input)
    I want it to copy into a new line at the bottom of the data in the Incidents tab, and also a copy of the data into the IncidentsMaster tab and then clear the data.

    I have triple checked the sheet names, and they are correct, so why is it not able to Set the Worksheet ?

    Any idea's ?

    Many thanks

    Rich
    Last edited by 6StringJazzer; 03-20-2024 at 10:32 AM. Reason: please use code tags

  2. #2
    Registered User
    Join Date
    11-23-2023
    Location
    Yorkshire, England
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Subscript out of Range ? Run time error 9

    Actually I might have found the issue, I have the Macro stored in my PERSONAL rather than on the actual sheet. That is most probably why the Subscript is out of Range.

    Can anyone help re-write this so the macro can be stored in PERSONAL rather than on the Worksheet, as this is not possible ?

    Many thanks

    Rich

  3. #3
    Registered User
    Join Date
    11-23-2023
    Location
    Yorkshire, England
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Subscript out of Range ? Run time error 9

    I assume I will have to DIM and SET the actual Workbook as well as the worksheets ?

    Workbook Name is 'Incident Record'

    Cheers

    Rich

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Subscript out of Range ? Run time error 9

    You could try referencing the ActiveWorkbook.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-23-2023
    Location
    Yorkshire, England
    MS-Off Ver
    Office 365
    Posts
    11

    Re: Subscript out of Range ? Run time error 9

    Thank you, this really helped and widened my learning in VBA. Many thanks ByteMarks

  6. #6
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Subscript out of Range ? Run time error 9

    You're very welcome.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Subscript out of Range ? Run time error 9

    Skullypots

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however we recommend that you include code tags around your code.

    I have added them for you because you are fairly new.

    Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Guideline #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. [SOLVED] Run-Time error 9 subscript out of range
    By josros in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-17-2021, 05:37 PM
  2. Error code "run time error 9: subscript out of range
    By iBennett93 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-28-2021, 05:03 AM
  3. [SOLVED] Run Time Error 9 - Subscript out of range
    By kersplash in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-25-2018, 02:05 AM
  4. Run Time error 9 Subscript out of range
    By kaseyleigh in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-28-2016, 08:57 AM
  5. [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
  6. [SOLVED] run-time error '9': Subscript out of range - WHY??
    By pastotnikr in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2013, 03:31 PM
  7. Run-time Error '9': Subscript out of Range
    By bcn1988 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-11-2012, 03:01 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