P
paul
I have this code that downloads stock quotes into Excel
from Yahoo.It was posted some time ago on the newsgroup
boards by a poster named, HTH Shockley.
Sub GetYQuotes()
Base01 = "http://finance.yahoo.com/d/quotes.csv?s="
Base02 = "&f=sl1d1t1c1ohgv&e=.csv"
sURL = ""
SymString = ""
LastRow = Cells(65536, 1).End(xlUp).Row
For i = 1 To LastRow
SymString = SymString & Cells(i, 1) & " "
Next i
sURL = Base01 & SymString & Base02
Workbooks.Open sURL
Set rngSource = Cells(1).CurrentRegion
x = rngSource.Rows.Count
y = rngSource.Columns.Count
With ThisWorkbook.Sheets(1)
Set rngDest = Range(.Cells(1, 1), .Cells(x, y))
End With
rngDest.Value = rngSource.Value
ActiveWorkbook.Close SaveChanges:=False
End Sub
This code uses a list of symbols in the first column of
the first sheet in the workbook and gets basic quotes from
Yahoo.Instead of the first column I would like to be able
to assign a column(range?)for the symbols that are to be
looked up. For example; column("B") or range(B1:B20).
Would I need to change the destination range too? I new to
this gave it a shot and failed. Please help
thanks in advance,
Paul
P.S.using Office 2000
from Yahoo.It was posted some time ago on the newsgroup
boards by a poster named, HTH Shockley.
Sub GetYQuotes()
Base01 = "http://finance.yahoo.com/d/quotes.csv?s="
Base02 = "&f=sl1d1t1c1ohgv&e=.csv"
sURL = ""
SymString = ""
LastRow = Cells(65536, 1).End(xlUp).Row
For i = 1 To LastRow
SymString = SymString & Cells(i, 1) & " "
Next i
sURL = Base01 & SymString & Base02
Workbooks.Open sURL
Set rngSource = Cells(1).CurrentRegion
x = rngSource.Rows.Count
y = rngSource.Columns.Count
With ThisWorkbook.Sheets(1)
Set rngDest = Range(.Cells(1, 1), .Cells(x, y))
End With
rngDest.Value = rngSource.Value
ActiveWorkbook.Close SaveChanges:=False
End Sub
This code uses a list of symbols in the first column of
the first sheet in the workbook and gets basic quotes from
Yahoo.Instead of the first column I would like to be able
to assign a column(range?)for the symbols that are to be
looked up. For example; column("B") or range(B1:B20).
Would I need to change the destination range too? I new to
this gave it a shot and failed. Please help
thanks in advance,
Paul
P.S.using Office 2000