Results 1 to 2 of 2

Better method to downdload data into sheet?

Threaded View

  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


            qurl = "http://download.finance.yahoo.com/d/quotes.csv?s=%40%5EDJI," _
                & Symbol & "&f=sl1va2f6t8r5rr6r7j2s7enqd1&e=.csv"
                
    QueryQuote:
    
            With Sheets("Data2").QueryTables.Add _
                (Connection:="URL;" & qurl, _
                Destination:=Sheets("Data2").Range("B" & i))
                    .BackgroundQuery = True                 'execute the query in the background
                    .TablesOnlyFromHTML = False
                    .Refresh BackgroundQuery:=False     'execute the query
                    .SaveData = True
            End With



    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.

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. 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