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
Bookmarks