Extract numeric values from Multiple websites to Excel using VBA

Gautam cv

New Member
Joined
Sep 25, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi Folks,

I have trying to extract the follow info from multiple websites into a singe table in Excel.
Website 1 : (Financial Futures – Investing.com UK) to extract the values under 'Last' column for all the bonds.
Website 2 : (COVID Live - Coronavirus Statistics - Worldometer) to extract Total cases, Total deaths and Recovered values for countries. For example: Vietnam, Sri Lanka and UK.

I am able to pull the data from the website. However, unable to do so from the 2nd Website. I have the below query and would seek guidance where I am going wrong. I am a newbie and intend to learn a lot and progress further. Any help would be great !

Private Sub CommandButton1_Click()
Set objIE = CreateObject("InternetExplorer.Application")
Dim request As Object
Dim website As String
objIE.Top = 0
objIE.Left = 0
objIE.Width = 800
objIE.Height = 600
objIE.Visible = True
objIE.Navigate ("Government Bonds – Investing.com UK")
Do
DoEvents
Loop Until objIE.readystate = 4
Range("B2").Value = (objIE.document.getElementsByClassName("pid-8907-last")(0).innerText)
objIE.Navigate ("COVID Live - Coronavirus Statistics - Worldometer")
Range("C2").Value = (font-weight: bold; text-align:right" class="sorting_1")(0).innerText)

End Sub

Thank you
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,957
Messages
6,122,466
Members
449,086
Latest member
kwindels

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