shahin
Active Member
Although, I have already got guidance from this forum as to how I can parse table data from webpage, I would like to know how can I select a specific table out of 8 from a certain webpage using this bit of code. Thanks in advance for taking this into consideration.
Btw, the above code if executed gets the data of all tables available out there.
Code:
Sub TableData()
Dim xmlpage As New XMLHTTP60
Dim htmldoc As New MSHTML.HTMLDocument
Dim tbl As Object, tRow As Object, tCel As Object
With xmlpage
.Open "GET", "https://fantasy.premierleague.com/player-list/", False
.send
htmldoc.body.innerHTML = .responseText
End With
For Each tbl In htmldoc.getElementsByTagName("table")
For Each tRow In tbl.getElementsByTagName("tr")
For Each tCel In tRow.getElementsByTagName("td")
c = c + 1
Cells(x, c) = tCel.innerText
Next tCel
c = 0
x = x + 1
Next tRow
Next tbl
End Sub
Btw, the above code if executed gets the data of all tables available out there.
Last edited: