Hi I have this code below to scrape from the word "Wednesday" across to "Service Level Time Forecast" and then the time column below the word Wednesday to Excel. This works good.
I'm looking of help to pull the numbers, starting with (in this case) the highlighted number 4 to excel. Here is the element for the data in the first column:
The part I need help inserting into my code below is how to scrape the "fcContacts" piece above into excel.
Here is my VBA so far:
Thanks in advance for any help.
SD
I'm looking of help to pull the numbers, starting with (in this case) the highlighted number 4 to excel. Here is the element for the data in the first column:
HTML:
<div class="cell highlighted" style="width: 88px; background: none 0% 0% / auto repeat scroll padding-box border-box rgba(0, 0, 0, 0); color: rgb(0, 0, 0);" data-metric-ref="fcContacts" data-metric-position="0" data-metric-datatype="integer" data-rowid="0" data-original-background-color="rgba(0, 0, 0, 0) none repeat scroll 0% 0% / auto padding-box border-box">4</div>
The part I need help inserting into my code below is how to scrape the "fcContacts" piece above into excel.
Here is my VBA so far:
VBA Code:
Sub ScapeThis()
Dim HTML As HTMLDocument
Dim objIE As Object
Dim y As Integer
Dim result As String
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.navigate "insert website here"
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
x = 1
Set HTML = objIE.document
Set elements = HTML.getElementsByClassName("dayNameNode")
For Each element In elements
If element.className = "dayNameNode" Then
Sheets("Sheet1").Cells(1, x).Value = element.innerText ' change 1 to the row you want the data to go to
x = x + 1
End If
Next element
Set elements = HTML.getElementsByClassName("headerText")
For Each element In elements
If element.className = "headerText" Then
Sheets("Sheet1").Cells(1, x).Value = element.innerText ' change 1 to the row you want the data to go to
x = x + 1
End If
Next element
y = 2
Set elements = HTML.getElementsByClassName("timeCell")
For Each element In elements
If element.className = "timeCell" Then
Sheets("Sheet1").Cells(y, 1).Value = element.innerText ' change 1 to the column you want the data to go to
y = y + 1
End If
Next element
'Insert the part here to pull the column data
End Sub
Thanks in advance for any help.
SD