With the code below, i'm able to get current key statistics from Yahoo for multiple tickers. Do you know if it's possible to change the code below in order to get historical data ? For instance, the statistics registered for a ticker 3 years ago ?
Many thanks in advance for your answers and you for your help
Sub KeyStat()
For i = 2 To Sheets(1).Cells(1, 1).End(xlToRight).Column
ticker = Sheets(1).Cells(1, i)
qurl = "https://finance.yahoo.com/quote/" & ticker & "/key-statistics?p=" & ticker & ""
Sheets(2).Select
Sheets(2).Cells.Clear
With ActiveSheet.QueryTables.Add(Connection:="URL;" & qurl, Destination:=Sheets(2).Range("A1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = False
.Refresh BackgroundQuery:=False
.SaveData = True
End With
Sheets(2).Range("B3:B69").Copy
Sheets(1).Select
Cells(2, i).Select
ActiveSheet.Paste
CutCopyMode = False
Next i
End Sub