VBA Web scrape site and extract variable data

ziggyfo

New Member
Joined
Mar 24, 2021
Messages
24
Office Version
  1. 2019
Platform
  1. Windows
  2. MacOS
Hi geniuses ! :)
I have very little to offer in this regard and hoping somebody could help me if its not too big of an ask. I have been browsing for codes and tried various methods but have not had much success.

What im trying to achieve is scrape the below site for race results, however the results are variable and will change from day to day.

Each day the results will be updated as they happen, so below you will see some times that have not yet happened. Once they have happened they will populate 3 Places. Its worth noting that the color numbers are not text and appear to be images. I am looking for a code that can download all available races through out the day as and when its run to update with the new races.



TM1.1.jpg


I guess the formatting can can be anything really, but if it could be extract almost as is, that would be phenomenal! I have made an example below for reference

Screenshot 2021-04-10 at 18.00.01.jpg


The important part would be to be able to see the 1st, 2nd, 3rd winners so i can process the information further into a database.

Cheers
 
No well rocks on my side as it is so it seems you did not follow my direction #2 - the bad reader classic trap ! - : where is located the code ? …​
And I forgot to say : for Windows only obviously …​
I followed your directions, I activated the additional object and pasted the code in the worksheet module.

Ill be honest, I am not sure what you mean by "beginner starter demonstration" but I have assumed its just your code. pardon me if I have that wrong.

I opened a new work sheet, opened a new module and paste your code as in in there. First I included the HTML object and then the followed the object error on the line mentioned earlier. Not sure what part I didn't follow?
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
opened a new module and paste your code as in in there
This is your error as the code must be pasted not in any new module but in the worksheet module ‼​
One of the two ways : right click on the tab name then select code in the menu …​
As a starter demonstration, you could amend it if you want to add it in a general module​
you must add the worksheet reference each time it's necessary like for UsedRange as an example …​
 
Last edited:
Upvote 0
This is your error as the code must be pasted not in any new module but in the worksheet module ‼​
One of the two ways : right click on the tab name then select code in the menu …​
As a starter demonstration, you could amend it if you want to add it in a general module​
you must add the worksheet reference each time it's necessary like for UsedRange as an example …​

"you must add the worksheet reference each time it's necessary like for UsedRange as an example …"
Could you elaborate on this? I am not entirely sure what you mean with his, Do you mean I need to specify the cell reference where I want the data to go?

I have also tried the workbook but got the same error. See below, not sure if I'm doing something wrong, but here it is as I see it.


3.JPG
 
Upvote 0
Again your bad according to this picture ! The code as it is must be in the Sheet1 (Sheet1) worksheet module rather than in the workbook module !​
As I gave you a way to well paste the code in my previous post …​
 
Upvote 0
Do you mean I need to specify the cell reference where I want the data to go?
No as I never have stated about any cell reference ! …​
Hoping again you are under PC / Windows rather than on Mac …​
 
Upvote 0
Again your bad according to this picture ! The code as it is must be in the Sheet1 (Sheet1) worksheet module rather than in the workbook module !​
As I gave you a way to well paste the code in my previous post …​

Marc I do apologise, I have it working now. I clearly am a bad reader :) thanks for helping me through. Your code is exactly what I wanted.
 
Upvote 0
Solution always belongs to good readers ! Thanks for the Like !​
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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