I'm trying to copy data from below mentioned web-site, all the range of sizes and cost which is mentioned on the web-page I need that all data. I frame below code but I'm able to copy only three element. Can anybody please look into this?
Url- https://www.leetstorage.com/sizes-and-pricing
Sub TagClassName()
Dim ie As New InternetExplorer, ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Unit Data")
With ie
.Visible = True
.Navigate2 "https://www.leetstorage.com/sizes-and-pricing"
While .Busy Or .readyState < 4: DoEvents: Wend
Dim listings As Object, listing As Object, headers(), results(), r As Long, c As Long, item As Object
headers = Array("size")
Set listings = .document.getElementById("site_content").getElementsByTagName("ul")
ReDim results(1 To listings.Length, 1 To UBound(headers) + 1)
For Each listing In listings
r = r + 1
On Error Resume Next
results(r, 1) = listing.getElementsByClassName("font-size-NaN m-font-size-NaN")(0).innerText
On Error GoTo 0
Next
Next
ws.Cells(1, 1).Resize(1, UBound(headers) + 1) = headers
ws.Cells(2, 1).Resize(UBound(results, 1), UBound(results, 2)) = results
.Quit
End With
End Sub
Aucun commentaire:
Enregistrer un commentaire