I am trying to use Excel VBA to scrape data from a web table, but I am running into trouble referencing the table. The table I am trying to access is contained on the following webpage:
I have checked the source code for the new page and it looks to me like the data table starts on row 466 with this code:
table class="grid" id="proj" cellspacing="0" cellpadding="2"
I already have functioning VBA code that scrapes data from a table on a different webpage where the table I want to grab is defined with id=“playertable_0”. An excerpt from that code is at the end of this post.
I tried to reuse that code by changing HTMLdoc.getElementById("playertable_0") to HTMLdoc.getElementById("proj") or HTMLdoc.getElementByClass("grid"), but the code throws a Runtime Error 91 (object variable or with block variable not set) at the subsequent line in my VBA code, which is "Set tableRows = playerTable.Rows". I assume that the error is because playerTable isn't grabbing any data, and it is impossible to count the number of rows in nothing. So the question is, how do I instruct VBA to grab the data from the table with id=proj?
Thanks!
Code Excerpt:
Bookmarks