I wrote a query to download stock data from the web which works when I enter the symbol manually. However, I tried making the query to look for the symbol in a cell but can't fire it out. Any direction would be greatly appreciated. The code has more lines but for simplicity I copied below is the part of the VBA code that deals with this issue.
Dim qurl As String
Dim r As Integer
'
qurl = "http://finance.yahoo.com/q/ae?s=" & Cells(r, 15)
'
'
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=ActiveSheet.Range("B4"))
.PostText = "Yahoo_Analyst_Estimates Dynamic"
.Name = False
.FieldNames = False
.RefreshStyle = xlOverwriteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.HasAutoFormat = True
.RefreshOnFileOpen = 0
.BackgroundQuery = False
.TablesOnlyFromHTML = True
.SaveData = True
.Refresh BackgroundQuery:=False
.UseListObject = False
End With
Dim qurl As String
Dim r As Integer
'
qurl = "http://finance.yahoo.com/q/ae?s=" & Cells(r, 15)
'
'
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=ActiveSheet.Range("B4"))
.PostText = "Yahoo_Analyst_Estimates Dynamic"
.Name = False
.FieldNames = False
.RefreshStyle = xlOverwriteCells
.RowNumbers = False
.FillAdjacentFormulas = False
.HasAutoFormat = True
.RefreshOnFileOpen = 0
.BackgroundQuery = False
.TablesOnlyFromHTML = True
.SaveData = True
.Refresh BackgroundQuery:=False
.UseListObject = False
End With