+ Reply to Thread
Results 1 to 2 of 2

Better method to downdload data into sheet?

  1. #1
    Registered User
    Join Date
    09-16-2013
    Location
    Kansas, U.S.
    MS-Off Ver
    Excel 2007
    Posts
    17

    Better method to downdload data into sheet?

    The following is a segment of code that pulls stock quote information from Yahoo.
    The character string "sl1va2f6t8r5rr6r7j2s7enqd1" pulls 15 different quote properties. (s=symbol, l1=last value, v=volume, etc, see below)

    Column A contains stock symbols
    Column B will contain the .cvs data that is returned when the query is completed.


    I found this "With" construct that creates a QueryTable online.
    Immediately upon using the QueryTable command a "table" is created.
    Unfortunately one of the byproducts of using the QueryTable command is the table that is created cannot be modified therefore, every time the iteration increments to the next symbol in column A, it shoves column B to the right so as not to damage the already created querytable.

    Afters 10 symbols, the previous data is shifted 10 columns to the right.

    Also, every time it runs it inputs a row of "noise" before dropping to the following row and returning the "good" data.
    so, I end up getting two rows of data for each query.

    What I like about this command is it is VERY fast and runs in the background.

    Is there a similar way to execute what I am trying to do that is fast, runs in the background and keeps things in a single column.

    Thanks,
    dustin


    Please Login or Register  to view this content.



    for the curious, these links can give you some background information about retrieving Yahoo quote information.

    Current Quotes download:
    https://code.google.com/p/yahoo-fina...QuotesDownload

    current quote decoder ring:
    https://code.google.com/p/yahoo-fina...mQuoteProperty
    Last edited by Leith Ross; 04-20-2015 at 12:32 AM.

  2. #2
    Forum Contributor
    Join Date
    03-26-2015
    Location
    Cookeville, TN
    MS-Off Ver
    Excel 365
    Posts
    221

    Re: Better method to downdload data into sheet?

    I think something like this will work for you, assuming you want the downloaded CSV data to be split (via TextToColumns) into separate columns. In this example, the ticker symbol list starts in row 5. I download the data in sets of 50 ticker symbols, since I found that Yahoo chokes (or cuts you off) if you try to download data for like 200 tickers at once. The QueryTable delete at the end removes the data connection (otherwise you end up with an ever-growing list of open data connections):

    Please Login or Register  to view this content.
    Also, forgot to mention: If you don't want to expand the downloaded CSV data, just delete the TextToColumns line (7th line from the bottom)
    Last edited by Merf; 05-25-2015 at 08:56 AM. Reason: Correction

+ 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. How to transfer data from one sheet to another without cut & paste method?
    By jkumar8877 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2013, 01:28 PM
  2. Replies: 1
    Last Post: 07-25-2010, 11:54 AM
  3. VBA: Using the Find Method on an inactive sheet
    By BigBas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-18-2007, 06:49 PM
  4. Method Add of object Sheet failed
    By JonMitsu in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-10-2006, 03:29 AM
  5. [SOLVED] sheet copy method fails...
    By mark in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2005, 10:45 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