Inserting tabs based on stock names

teach_me_VBA

New Member
Joined
Dec 10, 2007
Messages
11
Could someone please help me with a problem I'm currently having? I have a list of stocks I would like to do some analysis on, but would like to create a VBA that does the legwork. I have created a VBA that downloads stock prices, but can only do one at a time. I have also included an embedded code to insert a row when I refresh the data and populate the cells accordingly.

The issue is that I would like to figure out a way to take the list of stocks I have and do all at once instead of one at a time. Is that possible and can anyone help with how this can be done? Below is what I'm trying to do.

On sheet1 I have a list of stocks, let's say
MSFT
GOOG
AXP
AAPL

I would like to be able to download the historical stock prices based on the following parameters in new tabs with the stock name as the name of the new tab:
Date
Open
High
Low
Close
Volume
Adjusted Close

I have my analysis set-up so once this is done, I can drop in the extra code I've already created and do back testing. I noticed that there is a workbook here that does this, but would really like to get the code so I know how to create myself in the future.

I know the VBA queries I've already created can be done together in one query, but since I'm new at writing VBA, I would like to do this in a methodical step-by-step process. And since I don't know how to pull historical stock data into new tabs and changing the tab name to the stock name, I would like to figure out how to do this first. Any help would be greatly appreciated. Thanks.

Ryan
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,216,033
Messages
6,128,427
Members
449,450
Latest member
gunars

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