+ Reply to Thread
Results 1 to 11 of 11

Run Time Error 9 - Subscript out of range

  1. #1
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    265

    Run Time Error 9 - Subscript out of range

    Currently getting this Run Time Error With:

    Please Login or Register  to view this content.
    Any Ideas why??

    Thank You

    JRidge

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Run Time Error 9 - Subscript out of range

    Where are "file" and "file1" defined and what do they contain?


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    265

    Re: Run Time Error 9 - Subscript out of range

    Solved

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    265

    Re: Run Time Error 9 - Subscript out of range

    Quote Originally Posted by TMS View Post
    Where are "file" and "file1" defined and what do they contain?


    Regards, TMS
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    265

    Re: Run Time Error 9 - Subscript out of range

    My problem is now:

    Please Login or Register  to view this content.
    Basically instead of pasting the value 11 columns to the right of c i need to:

    Find the Column with File1 value in.
    The value is then pasted where the c Row and the File1 Column intersect.

    Any Ideas would be greatly appreciated..

    Regards

    JRidge

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Run Time Error 9 - Subscript out of range

    You have the advantage of knowing what your workbook, worksheets and data look like.

  7. #7
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    265

    Re: Run Time Error 9 - Subscript out of range

    Yeah i suppose

    Doesn't help me work out how to code this part though

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Run Time Error 9 - Subscript out of range

    How many choices do you have? One column? Two columns? More than two columns? Lots of columns?

    One thought would be to assign the entire data area to a two dimensional array. You can them loop through the array with x and y co-ordinates until you find file1. Then you can use your x and y co-ordinates as an offset to the base cell address. That'll give you your starting point.

    The loop should be relatively quick regardless of the number of rows/columns as it's all in memory.

    Regards, TMS

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Run Time Error 9 - Subscript out of range

    As an example:

    Please Login or Register  to view this content.

    Regards, TMS

  10. #10
    Forum Contributor
    Join Date
    09-11-2013
    Location
    Germany
    MS-Off Ver
    Excel 2007
    Posts
    265

    Re: Run Time Error 9 - Subscript out of range

    Got around it by using this:

    Please Login or Register  to view this content.
    Get the column number when i paste the name in earlier in the script.


    Then:

    Please Login or Register  to view this content.
    and it works toooo

    Regards

    JRidge

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: Run Time Error 9 - Subscript out of range

    Thank you for sharing.

+ 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 - 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
  2. [SOLVED] Run-time Error '9': Subscript out of Range
    By Veena Anoohya in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-19-2014, 05:06 AM
  3. [SOLVED] subscript out of Range (Run time error 9), need help
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-05-2013, 02:31 PM
  4. Run time error 9 Subscript out of range
    By vijanand1279 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-28-2012, 03:30 PM
  5. Run time error 9 : Subscript out of range
    By JAtz_DA_WAY in forum Excel General
    Replies: 6
    Last Post: 08-29-2005, 03:26 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