Hi All,
Using the code below, I am able to populate the website data to excel sheet.
However, the code will extract the data from all tables (4 in total) and I would only need data from one table only.
The source code for the intended table:
table class="basicTable" id="inventoryTable"
Would it be possible to tweak the code so that it will fetch data from the specific table only?
Thank you.
'/ Data scrapping for populated table
Dim elemCollection As Object
Dim r As Integer, c As Integer, t As Integer
Set html_inventory = ie.document
Set elemCollection = html_inventory.getElementsByTagName("table")
'Set elemCollection = html_inventory.getElementById("inventoryTable") '/ testing
For t = 0 To (elemCollection.Length - 1)
For r = 0 To (elemCollection(t).Rows.Length - 1)
For c = 0 To (elemCollection(t).Rows(r).Cells.Length - 1)
Sheets("Sheet2").Cells(r + 1, c + 1) = elemCollection(t).Rows(r).Cells(c).innerText
Next c
Next r
Next t
Bookmarks