jamescooper
Well-known Member
- Joined
- Sep 8, 2014
- Messages
- 840
Hello,
If the VBA below cannot find anything for the particular pull I'd like it to Goto 1: and put a blank/1, can anyone help?
Thanks.
If the VBA below cannot find anything for the particular pull I'd like it to Goto 1: and put a blank/1, can anyone help?
Thanks.
Code:
Public Sub Data_Pull_Products_and_Prices_2()
Dim http As Object, html As New HTMLDocument, topics As Object, topics2 As Object, titleElem As Object, topic As HTMLHtmlElement
Dim i As Integer
Dim j As Integer
Dim rngURL As Range
Dim LastRow As Long
Dim LastRow2 As Long
Application.ScreenUpdating = False
Set http = CreateObject("MSXML2.XMLHTTP")
For Each rngURL In Worksheets("Sheet1").Range("E1", Worksheets("Sheet1").Range("E" & Rows.Count).End(xlUp))
http.Open "GET", rngURL, False
http.send
html.body.innerHTML = http.responseText
DoEvents
Set topics = html.getElementsByClassName("product-tile-wrapper")
i = 1
For Each topic In topics
On Error GoTo 1:
Set titleElem = topic.getElementsByTagName("DIV")(0)
Sheets(1).Cells(i, 1).Value = titleElem.getElementsByTagName("p")(0).innerText
i = 1 + LastRow
1: """
Next
Next
Application.ScreenUpdating = True
End Sub