+ Reply to Thread
Results 1 to 6 of 6

Run-Time error '9': Subscript out of range

  1. #1
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Run-Time error '9': Subscript out of range

    I have this code in excel:

    Please Login or Register  to view this content.
    Heres the txt file:

    Please Login or Register  to view this content.
    I intend to insert all values from txt file into Excel, but via VBA.

    My error is:

    Subscript out of range

    But doe not highlight the code in VBA
    Last edited by Eduards; 11-27-2019 at 09:13 AM.

  2. #2
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: Run-Time error '9': Subscript out of range

    Usually this error is received then there is some objects missing on the code.
    Like in this case,the file / folder might not exist OR Sheet1 doesn't exist (It might have some other name.)

    Check that out. Hope it will solve.
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Run-Time error '9': Subscript out of range

    I'd guess that at least one line doesn't have the same number of commas.
    Rory

  4. #4
    Forum Contributor
    Join Date
    11-01-2018
    Location
    England
    MS-Off Ver
    2016
    Posts
    280

    Re: Run-Time error '9': Subscript out of range

    Hi both,

    I was missing an extra line of code:

    Please Login or Register  to view this content.
    There was extra information on the CSV file

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,901

    Re: Run-Time error '9': Subscript out of range

    That could not possibly cause a Subscript out of range error.

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,286

    Re: Run-Time error '9': Subscript out of range

    removed as I didn't look at the loop, should have been
    Please Login or Register  to view this content.
    Last edited by nigelog; 11-27-2019 at 12:41 PM.

+ 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 Tegglet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-25-2017, 01:44 PM
  2. [SOLVED] run time error 9, subscript out of range.How to fix it?
    By ImranBhatti in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-20-2016, 03:34 PM
  3. Run time error 9 subscript out of range
    By Jagadeesank in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-30-2015, 03:12 AM
  4. Run-time error '9': Subscript out of range
    By ndsutherland in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-26-2014, 01:43 AM
  5. [SOLVED] Run-time error '9': Subscript out of range
    By chergian in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2014, 02:40 AM
  6. [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
  7. Run-time Error '9': Subscript out of range
    By tryaz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-23-2009, 02:13 PM

Tags for this Thread

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