VBA Code to download historical stock quotes

I am using the following VBA code to download yahoo historical stock quotes.  The result puts the stock quote csv into a single cell (destination C6).  How would I modify the parameters so that each value in the table is put into a seperate cell?  Thanks in advance to anyone that can help.

qurl = "http://ichart.yahoo.com/table.csv?s=" & Symb
        qurl = qurl & "&a=9&b=6&c=2007&d=" & Month & "&e=" & _
            Day & "&f=" & Year & "&g=d&ignore=.csv"
       
        With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=Range("C6"))
                .BackgroundQuery = True
                .TablesOnlyFromHTML = False
                .Refresh BackgroundQuery:=False
                .SaveData = True
             End With
DLW2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

harr22Commented:
I do something very similar and just parse it out with "Text To Columns"  Here is my code that does the parsing, hard to tell from what you posted if this will work for you as is or if you have to tweak it.  You could just record a macro performing the text to columns function.

 
Columns("A:A").Select
                Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
                TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
                :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
                Array(7, 1)), TrailingMinusNumbers:=True
                Range("A:A").NumberFormat = "mm/dd/yyyy;@"
                Columns.AutoFit

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DLW2Author Commented:
Harr22:

OK thanks.  I thought it was as simple as a missing parameter in the query tables statement but maybe not.  I will give your suggestion a try.  Dave
0
DLW2Author Commented:
Harr22:

Thank you - this worked.  I was not aware of the text to column feature.
0
harr22Commented:
OK thanks.  I thought it was as simple as a missing parameter in the query tables statement but maybe not.  I will give your suggestion a try.  Dave

I don't think you can make the query return it in multiple columns.  I fought with it for a while a couple years ago.  Glad you got the text to columns method to work out for you, its a pretty cool feature.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.