normanbox

New Member
Joined
Jul 8, 2015
Messages
46
I am stuck and don’t know where to even begin and am not even sure if what I want to do is even possible, but then again, I really don’t know VBA. I’ll be as specific as possible. I’m looking for a solution to the following problem, likely VBA code.

I have a workbook with “Sheet 1” and “Sheet 2.” Sheet 1 has three web queries from Yahoo Finance:

http://finance.yahoo.com/q/is?s=A+Income+Statement&annual
http://finance.yahoo.com/q/bs?s=A+Balance+Sheet&annual
http://finance.yahoo.com/q/cf?s=A+Cash+Flow&annual

In each of the above web addresses, the address points to a stock by using a ticker symbol, in this case “A”. In addition, because I don’t want the whole page, I have “checked” only the table next to “Period ending” to be imported. The tables from the query are then imported into Sheet 1 starting at B3, I3, and P3 respectively.

I have a list of stock ticker symbols in Sheet 2. Cell A1 currently has the symbol “A”, but I would like to update the ticker symbol to another symbol, i.e. MSFT and have the queries in “Sheet 1” all update to the new symbol, including only importing the same selected. The result would be the following:

http://finance.yahoo.com/q/is?s=MSFT+Income+Statement&annual
http://finance.yahoo.com/q/bs?s=MSFT+Balance+Sheet&annual
http://finance.yahoo.com/q/cf?s=MSFT+Cash+Flow&annual

Automating this process is very important to me because I have a lot of stock ticker symbols I’d like to review. Your help will be extremely appreciated!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I have a list of stock ticker symbols in Sheet 2. Cell A1 currently has the symbol “A”, but I would like to update the ticker symbol to another symbol, i.e. MSFT and have the queries in “Sheet 1” all update to the new symbol, including only importing the same selected.
It sounds like you need a dynamic web query. See MS Excel Web Query Secrets Revealed. You can also create a dynamic web query in VBA without the need for the .iqy file that the first link uses - see WebQuery.
 
Upvote 0
That worked, except I can't seem to get the address to query the one table, but I can work around querying the whole page.

Thank you,
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,824
Members
449,470
Latest member
Subhash Chand

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