-3

I have 15,000 web pages all in the same format listed in column A, I need to pull of the available stock for each product and paste it into Column H. I have tried multiple solutions that I have found online with no success.

My first URL is : view-source:https://www.coolings.co.uk/shop/products/plants/bedding/all-bedding/osteospermum-mixed-10-5cm-pot.html

The figure I want is nestled here (125):

<div class="availability-wrapper">
      <div class="availability in-stock">125 available</div>
  </div>

Any help appreciated.

Minal Chauhan
  • 6,025
  • 8
  • 21
  • 41
  • They are all the same, sorry I should have referenced the other code i have tried to modify with no success: https://stackoverflow.com/questions/56962497/webscrape-loop-on-all-urls-in-column-a/67266821#67266821 – Rory Watts Apr 26 '21 at 13:00

1 Answers1

0

Here is an example, to get the available stock from the URL you provided. You would have to loop over all the URLs and adjust the code acordingly:

Sub getStock()
    Dim IE As Object, Doc As Object, Ele As Object
    
    Set IE = CreateObject("internetexplorer.application")
    IE.navigate "https://www.coolings.co.uk/shop/products/plants/bedding/all-bedding/osteospermum-mixed-10-5cm-pot.html"

    Do While IE.ReadyState <> 4 Or IE.Busy: DoEvents: Loop
    
    Set Doc = IE.Document
    Set Ele = Doc.getElementsByClassName("availability in-stock")
    
    Debug.Print Ele(0).innerText
    IE.Quit
    Set IE = Nothing: Set Doc = Nothing: Set Ele = Nothing
End Sub
MGP
  • 2,480
  • 1
  • 18
  • 31