vba yahoo! finance

  • Thread starter Thread starter Arun Ram Kumaran
  • Start date Start date
A

Arun Ram Kumaran

Is it possible to write a routine in VBA that can download current
stock prices from, say, Yahoo! Finance, and then update a workbook
with that information? If so, I'd appreciate any pointers on how to
do so.
 
This will do it. Contact me privately for more.

Sub getit()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Set datasheet = ActiveSheet
With datasheet
Range("a3:a200").EntireRow.Delete
End With
qurl = "http://table.finance.yahoo.com/k?s=ibm&g=d"
With datasheet.QueryTables.Add(Connection:="URL;" & qurl,
Destination:=datasheet.Range("B7"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
End Sub
 
Back
Top