+ Reply to Thread
Results 1 to 14 of 14

Subscript out of range - help!

  1. #1
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Subscript out of range - help!

    im trying to use excel to say, when i insert stock symbols on column A, it would load me the stock prices...
    when i insert till 200 rows, it seems to work
    but if say, i insert 400 rows, i starting to get the error: subscript out of range.

    test1.JPG

    Pls help!



    my code:
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 09-14-2014 at 12:11 AM. Reason: Added Code Tags

  2. #2
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Subscript out of range - help!

    Hi geekohi,

    This error means that the code cannot locate something it is supposed to work/make changes on.

    It could mean a misspelled/missing object such as a Worksheet name just as one example.

    Can you post the file you're using and advise the row that the error occurs on?

    Thanks
    Remember you are unique, like everyone else

  3. #3
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Re: Subscript out of range - help!

    Hi, noboffinme, I really appreciate your response and truly thankful if you could make this work.

    the download link for the file: https://www.sendspace.com/file/frn43o

    the code you should be focusing is in "sheet19 (stocks)" line 135 to 179 under the tab loaddata()

    I want to be able to download say a thousands of stocks data instead of hundreds. Thanks.

  4. #4
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Re: Subscript out of range - help!

    Quote Originally Posted by noboffinme View Post
    Hi geekohi,

    This error means that the code cannot locate something it is supposed to work/make changes on.

    It could mean a misspelled/missing object such as a Worksheet name just as one example.

    Can you post the file you're using and advise the row that the error occurs on?

    Thanks
    Hi, noboffinme, I really appreciate your response and truly thankful if you could make this work.

    the download link for the file: https://www.sendspace.com/file/frn43o

    the code you should be focusing is in "sheet19 (stocks)" line 135 to 179 under the tab loaddata()

    I want to be able to download say a thousands of stocks data instead of hundreds. Thanks.

  5. #5
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Subscript out of range - help!

    Can you post the file through this site?

    Go to 'Go Advanced' >> 'Manage Attachments' >> 'Select File' >> 'Upload File' >> 'Done'

    Thanks

  6. #6
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Re: Subscript out of range - help!

    Quote Originally Posted by noboffinme View Post
    Can you post the file through this site?

    Go to 'Go Advanced' >> 'Manage Attachments' >> 'Select File' >> 'Upload File' >> 'Done'

    Thanks
    yeap, done.
    Attached Files Attached Files

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Subscript out of range - help!

    Where in the code do you get the error?
    If posting code please use code tags, see here.

  8. #8
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Re: Subscript out of range - help!

    Quote Originally Posted by Norie View Post
    Where in the code do you get the error?
    the thing I dont quite understand is, I am not getting any errors in my code.

    The code does function as expected when say, I insert roughly 200 stock code on column A.

    If I insert > 300-400, then it runs and just says that: subscript out of range (without pointing to me, where in the code I get the error)

    Im trying to make this stock data loader applicable to say, thousands of stocks.


    The line of code used for the loading process (when press on "load button"), its sheet19 (stocks)

    Please Login or Register  to view this content.

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Subscript out of range - help!

    When you get the error is there no option to debug?

  10. #10
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Re: Subscript out of range - help!

    Im still a newbie to programming using excel, starting to learn.

    Everytime I got an error, excel will roughly highlight the line of code in yellow, I will work from there on.

    But for this, when I got the error, there is no indication of where which the line got the error.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Subscript out of range - help!

    VBA should highlight the line the error occured on when you click debug.

    It won't specifically say what in that line caused the error.

    I've actually got a hunch that this is what's causing the problem, probably something to do with the response the the web request not being what you expected.
    Please Login or Register  to view this content.
    In fact when I run the code this is what sLine is.
    Quote Originally Posted by Yahoo Finance
    Sorry, the Yahoo Finance system limits quotes to 200 ticker symbols at a time, and your request included 373ticker symbols. Please adjust your request to include 200 or less.
    and if I look further up in the code this is what's in Resp, which is the response from the web query.
    Quote Originally Posted by Yahoo Finance
    Sorry, the Yahoo Finance system limits quotes to 200 ticker symbols at a time, and your request included 373ticker symbols. Please adjust your request to include 200 or less.

  12. #12
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Re: Subscript out of range - help!

    Thx Norie, I researched further and found that the limit is set at 200 ticker symbols at a time. Not very convenient if I'm trying to load all at once.

    Have any suggestion how I can improvise this.

  13. #13
    Registered User
    Join Date
    09-13-2014
    Location
    australia
    MS-Off Ver
    2013
    Posts
    11

    Re: Subscript out of range - help!

    Can I actually scrap data from the official stock data website, such as this one using the same method as before

    but grabbing all data at once based on its stock code:

    http://www.bursamalaysia.com/market/...tock_code=0010

  14. #14
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Subscript out of range - help!

    I found the code throws this error as it looks for a worksheet called 'Trading Volume' in the 'Calculator Sub.

    Please Login or Register  to view this content.

+ 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. Subscript Out of Range
    By blyzzard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2013, 05:25 PM
  2. 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
  3. 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
  4. 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
  5. Subscript out of range?
    By Iamkar33m in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2007, 10:22 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