Here is the link from where I'm trying to return price values only: https://www.express-supp...
I have got a VBA script which returns all product-grid-details table values into the workbook but some of the values goes into the wrong columns which does not allow pivot pivot table to be generated. But if I change this code to generate table called price-box it doesn't return any values at all.
I think HTML tables on the page is out of order and not sequenced with each other and that is what it makes the data to be out of columns. As a solution I would like the VBA to return ONLY item names and prices of the page but not the whole lot. How do I do it?
Example of how table is returned into the workbook if choosing to return product-grid-details:
Here is the code:
With CreateObject("WINHTTP.WinHTTPRequest.5.1")
.Open "GET", "https://www.express-supplements.co.uk/catalogsearch/result?q=Optimum+Nutrition", False
.send
oHtml.body.innerHTML = .responseText
Debug.Print
End With
ReDim a(1 To 100000, 1 To 60)
For Each oElement In oHtml.getElementsByClassName("product-grid-details")
i = i + 1
x = Split(oElement.innerText, vbCr)
For ii = 1 To UBound(x)
a(i, 1) = nowDate
a(i, 2) = nowTime
a(i, 3) = weblinks(webX, 1)
a(i, 4) = weblinks(webX, 2)
a(i, ii + 4) = Trim$(x(ii))
Next
Next oElement
With SHwebdata
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Cells(LastRow + 1, 1).Resize(i, UBound(a, 2)) = a
i = 0
End With