Extract specific text from the table

jayymehta

New Member
Joined
Jan 3, 2018
Messages
18
I want the brand name to be extracted from a table, in a website in my excel sheet. There's this table which has information about the product's warranty, shipping and brand, which is under one single "div" element. So I'm unable to extract only the brand name, instead it extracts all the data from the table. I tried my best to code, and I think it would be solved by using IntStr or Mid function, but don't know how to use it here.

Code:
For Each objDiv In doc.getElementsByTagName("div")    If objDiv.ID = "CenterPanelInternal" Then
        For Each objh1 In objDiv.getElementsByTagName("h1")
            If objh1.className = "it-ttl" Then
                ThisWorkbook.Worksheets("Sheet1").Range("A1:N1").Value = objh1.outerText
            End If
        Next
        
        For Each objdiv2 In objDiv.getElementsByTagName("div")
            If objdiv2.className = "u-flL w29 vi-price" Then
                ThisWorkbook.Worksheets("Sheet1").Cells(3, 1).Value = objdiv2.outerText
            End If
        Next
    End If

    If objDiv.ID = "viTabs" Then       
        For Each objdiv3 In objDiv.getElementsByTagName("div")
            If objdiv3.className = "itemAttr" Then
                ThisWorkbook.Worksheets("Sheet1").Cells(3, 2).Value = objdiv3.outerText
            End If
        Next
    End If
Next

 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,223,907
Messages
6,175,300
Members
452,633
Latest member
DougMo

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