+ Reply to Thread
Results 1 to 9 of 9

Subscript out of range

  1. #1
    Registered User
    Join Date
    03-04-2014
    Location
    manila, philippines
    MS-Off Ver
    Excel 2010
    Posts
    22

    Subscript out of range

    Now I don't know what's causing this. Kindly help me out guys please..Everytime I run the code it pops an error saying Subscription out of range.

    Thank you in advance guys.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Subscript out of range

    Sounds like not all of the lines have five commas.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    03-04-2014
    Location
    manila, philippines
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Subscript out of range

    Yup. Some lines let's say have less than 5 data while some have only 2 or 3. Can you give me an advice with regards to this.

    Thanks.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Subscript out of range

    Hi, rflorentino,

    IŽd go away from using ActiveCell for code ASAP. Maybe like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Subscript out of range

    Check this...

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  6. #6
    Registered User
    Join Date
    03-04-2014
    Location
    manila, philippines
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Subscript out of range

    Hi to both of you and thank you for helping me. It turned out real good. Now for the next problem probably related to this one so I decided not to open another topic since it has something to do with this topic.

    Now that I can transfer all file from .csv file to my excel here's another problem.

    Here's the scenario

    1. If book 1 (.cs)is like this
    name age gender phone bday
    John 12 male 989101011 dec 15 1984
    Mary 15 female 010998481 april 9 1960
    Robert 22 male 12345678 July 22, 1978

    and my excel is like this

    age bday name gender phone


    Same code I have given before...How will I transfer file if my book has constant headers such as seen above. I'm totally out of idea how to start this one. Please help.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Subscript out of range

    Hi, rflorentino,

    why do the files differ from your workbook (or put another way: will there be more different ways of receiving the information)? From what I spot you could alter the design of your workbook or use a loop to transfer the data while searching for the headers and then copying info.

    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    03-04-2014
    Location
    manila, philippines
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Subscript out of range

    Quote Originally Posted by HaHoBe View Post
    Hi, rflorentino,

    why do the files differ from your workbook (or put another way: will there be more different ways of receiving the information)? From what I spot you could alter the design of your workbook or use a loop to transfer the data while searching for the headers and then copying info.

    Ciao,
    Holger
    Hi Good Sir,

    Thanks once again for the solution before that you gave me. It really worked out a you have stated. With regards to my last post, Yes there are more different ways of receiver the information. So now, I do not know exactly how to formulate a code for this as I'm more comfortable working in asp. and this is my first project for myself as a newbie developer for VBA .

    Can you give me sir an example on how to get this done? Cheers and once again thanks for the answer.

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Subscript out of range

    Hi, rflorentino,

    I doubt that you would expect the find the solution to your follow-up question if you google "subscript out of range" and recommend to start a new thread on that subject with two sample workbooks, one holding the macro, one holding some sample data for checking out the code.

    Ciao,
    Holger

+ 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. what does subscript out of range mean?
    By amartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2013, 01:55 AM
  2. Subscript out of range error while populating array from range.
    By Aussiexile in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-04-2010, 02:22 AM
  3. Subscript out of range error when trying to select a range
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2010, 07:57 PM
  4. subscript out of range
    By wdonovan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-08-2009, 09:32 AM
  5. subscript out of range
    By palm101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2009, 04:13 AM

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