VBA to pull data from div tag in HTML code

aaaaa34

Board Regular
Joined
Feb 25, 2014
Messages
62
Hello,

I want to take needed data from HTML code as you will see along A column in Sheet1 of excel file I attached. In Sheet2, you'll see the desired result after VBA runs.
Microsoft Power Automate I tried already, but it's not possible to implement it into this task due to varying URL.

1- League Name to B column
2- Date to C column
3- Hour to D column
3- Home Team to E column
4- Away Team to F column
5- Home Wins Odds to G column
6- Draw Odds to H column
7- Away Wins Odds to I column
8- Over Goals Odds to J column
9- Goals Line to K column
10- Under Goals Odds to L column

Please have a look into attached files link in the below.

In *.docx file you can see which data coming from which HTML tag.

I want to mention two points:

a) There are 4 Leagues , 8 Matches. So B column league names should be filled only when there is new league tag appears (class="c-events__liga">England. Premier League</a>)

b) In 7th match (Wolfsburg-Dortmund) only three odds available

Home Team Wins, Draw, Away Team Wins (here you can check tags image https://www.file.io/hUvx/download/zvQNApj2G0TN)

but,

goals over odds, goals line number, goals under odds are not available like other seven matches. (here its image: https://www.file.io/2ZlA/download/VMCROKk68JZN)

Thanks for your interest.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,223,227
Messages
6,170,848
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