Pulling data table from multiple pages

haominimalist

New Member
Joined
Aug 4, 2017
Messages
2
Hi,

My excel VBA skillls are very poor. I managed to construct a simple code to pull from one of the required pages, but I need a code that is both efficient (will not kill my computer RAM) and/or dynamic OR simply pulls data from all pages.

Every week I pull a data table from a link such as this:
[TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"][TABLE="width: 64"]
<tbody>[TR]
[TD="width: 64"]https://www.investing.com/indices/us-30-historical-data[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

The only thing that changes in the URL is the "us-30", for example to "nq100" or "us-spx-500".

Could someone help me out with a code where I can just paste the 25 links into and it pulls the different tables into 1 sheet (one after another)? Table sizes are the same across, and in the same position.

Thanks in advance!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Dim objWeb As QueryTable
Dim sWebTable As String

sWebTable = 4

Set objWeb = ActiveSheet.QueryTables.Add( _
Connection:="URL;https://www.investing.com/indices/us-30-historical-data", _
Destination:=Sheets("Prices").Range("a2"))

With objWeb

.WebSelectionType = xlSpecifiedTables
.WebTables = sWebTable
.Refresh BackgroundQuery:=False
End With
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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