So due to constraints, I need to parse some ugly html with excel vba. the problem with the HTML is that it has no element IDs. I have a page that has many unlabeled tables that each have a couple rows. The only thing I can build from is that there is an identifier in one of the cells that I need to pull. Every time the ID "xtu_id" appears as a value in a cell in a row of a table, I want to pull the data from that row. So it looks like this:
<tr>
<td>
col1
</td>
<td>
col2
</td>
<td>
xtu_id
</td>
<td>
col4
</td>
</tr>
Now that I see xtu_id exists in this row, I want to dump all cells of that row into an excel sheet. Here is what I used from reading other stackoverflow posts:
Sub CommandButton1_Click()
Dim appIE As InternetExplorerMedium
Set appIE = New InternetExplorerMedium
With appIE
.Navigate "https://my_website"
.Visible = True
End With
Do While appIE.Busy Or appIE.ReadyState <> 4
DoEvents
Loop
Set mydata = appIE.Document.getElementsByTagName("tr")
For Each e In mydata
For Each c In e
If c.Cells().innerText Like "xtu_id" Then
myValue = c.Cells().innerText
MsgBox (myValue)
End If
Next c
Next e
Set appIE = Nothing
End Sub
This code works until I get to the [for each...] statement, I have trouble looping through each cell of each row to search for the "xtu_id" text. Any ideas on how to do this?