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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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