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:
https://www.investing.com/indices/us-30-historical-data

<tbody>
</tbody>

<tbody>
</tbody>

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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
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,215,773
Messages
6,126,821
Members
449,340
Latest member
hpm23

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