My code is a bit raggedy but I pieced together something that does build the correct URL
Sub LoopHistorical_Data()
'Local Variable
Dim IE As InternetExplorer
Dim HTMLDoc As HTMLDocument
Dim rngTicker As Range
Dim rngStMo As Range
Dim rngStDa As Range
Dim rngStYr As Range
Dim rngEMo As Range
Dim rngEDa As Range
Dim rngEYr As Range
Dim rngQuerySymData As Range
Dim qryTableStocks As QueryTable
Set rngTicker = Worksheets("Sell").Range("A2")
Set rngStMo = Worksheets("Sell").Range("M2")
Set rngStDa = Worksheets("Sell").Range("N2")
Set rngStYr = Worksheets("Sell").Range("O2")
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
With ActiveWorkbook.Sheets("Sell")
Dim LastCol As Long
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
Dim NewCol As Long: NewCol = LastCol + 1
'Set Data Ranges
Set rngEMo = Worksheets("Sell").Range("Q2")
Set rngEDa = Worksheets("Sell").Range("R2")
Set rngEYr = Worksheets("Sell").Range("S2")
Set rngQuerySymData = Worksheets("Web Query Page").Range("A5").Range("E1:P1")
Set qryTableStocks = ThisWorkbook.Worksheets("Web Query Page").QueryTables(1)
On Error Resume Next
'Loop through list of Ticker Symbols and retrieve Historical Data
Dim RowCount As Long: RowCount = 1
Do While .Range("A" & RowCount).Value <> ""
Dim Dest_Range As Range: Set Dest_Range = .Cells(RowCount, NewCol)
Dim StockName As String: StockName = .Range("A" & RowCount)
Dim URL As String
URL = "http://finance.yahoo.com/q/hp?s=" & rngTicker & "&a=" & (rngStMo - 1) & "&b=" & rngStDa & "&c=" & rngStYr & "&d=" & (rngEMo - 1) & "&e=" & rngEDa & "&f=" & rngEYr & "&g=m"
With IE
.navigate URL
.Visible = True
'Wait for page to load
Do While .readyState <> 4 Or IE.Busy = True
BLAH BLAH BLAH ... until End sub
Bookmarks