Hello,
I am currently trying to pull financial information from Yahoo's Key Statistics Page . I was able to find a script online but i cannot figure out how to adjust the script to import all of the data on the same excel tab rather than creating a new separate tab for every ticker. I am also only trying to pull 3 pieces of information: Total Debt (mrq), Total Cash (mrq), Revenue (ttm), NNet Income Avl to Common (ttm): and Market Cap (intraday)5:
Sub Macro2()Dim conString As String
Dim conName As String
Dim txtSymbols(0, 2) As String
txtSymbols(0, 1) = "MSFT"
txtSymbols(0, 2) = "CSCO"
For i = 1 To 2
Sheets.Add After:=Sheets(Sheets.Count)
ActiveSheet.Name = txtSymbols(0, i)
conString = "URL;http://finance.yahoo.com/q/ks?s=" & txtSymbols(0, i) & "+Key+Statistics"
conName = "ks?s=" & txtSymbols(0, i) & "+Key+Statistics"
With ActiveSheet.QueryTables.Add(Connection:=conString, Destination:=Range("$A$1"))
.Name = conName
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = """yfncsubtit"",2,3,5,7,9,10,13,17,19,21,23"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next i
End Sub
Can anyone assist? Thank you!!