Hello Group,
Hope everyone is having a good day. I am running a query on a list of symbols. Code is as follows:
Sym = Range("A" & ActiveCell.Row).Value
myurl = "http://download.finance.yahoo.com/d/quotes.csv?s=" & Sym & "&f=l1wde"
Set qt = ActiveSheet.QueryTables.Add( _
Connection:="URL;" & myurl, _
Destination:=Range("K" & ActiveCell.Row))
With qt
.Refresh BackgroundQuery:=False
End With
qt.Delete
Selection.TextToColumns Destination:=ActiveCell, DataType:=xlDelimited, Comma:=True, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), TrailingMinusNumbers:=True
ActiveCell.Offset(1, 0).Select
Everything is running fine, but the query is inserting a column each time it runs, thus it displaces everything over one column above it. I have tried to figure out what parameter to add, so that it will not do this, but am failing to figure it out.
Any ideas would be appreciated.
Thanks,
David
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar