Data extraction from HTML

Sharid

Well-known Member
Joined
Apr 22, 2007
Messages
1,064
Office Version
  1. 2016
Platform
  1. Windows
I am trying to pull the following data from this html text, but can not seem to work it out. I have the bulk of my code and was trying to change some parts that deal with the extraction but can not work this out. Please could someone take a look

1602167785324.png


Code that should pull off the data
VBA Code:
           For Each li In HTMLdoc.getElementsByTagName("li")
                If li.getAttribute("class") = "a-link-normal" Then 
                Set link = li.getElementsByTagName("a")(0)
                .Cells(i, 1).Value = link.getAttribute("href")
                i = i + 1
            End If
    Next li

Another variation of the code
VBA Code:
      For Each div In HTMLdoc.getElementsByClassName("a-row a-spacing-none s-see-all-c3-refinement s-see-all-refinement-list")
                If div.getAttribute("class") = "s-see-all-indexbar-column" Then 
                Set link = div.getElementsByTagName("a")(0)
                .Cells(i, 1).Value = link.getAttribute("href")
                i = i + 1
            End If
    Next div

As always thanks in advance
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top