VBA to extract part of HTML code

smide

Board Regular
Joined
Dec 20, 2015
Messages
162
Office Version
  1. 2016
Platform
  1. Windows
Hello.


In cell A1 I'm receiving Customer names an their home town in form of huge HTML code.
I need to extract Customer names in column A (A3:A600) and their home towns in column B (B3:B600).

Part of HTML code for names is always the same:
HTML:
<div class="customName--1gBeC">J. Jones</div>

Part of code for towns is also always the same:
HTML:
<td class="search-results-table-column-town ">Sydney</td>


Basically I need to extract somehow only part between
HTML:
1gBeC">
and
HTML:
</div>
for Name and part between
HTML:
column-town ">
and
HTML:
</td>
for Town.


I'm using excel 2007.

example.

AB
1HTML code
2
3J. JonesSydney
4C. DuncanToronto
5M. WeberMünchen
6........

<tbody>
</tbody>
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

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