ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I Launch a Macro on a different sheet (https://www.excelbanter.com/excel-programming/288393-how-do-i-launch-macro-different-sheet.html)

Pepe[_2_]

How do I Launch a Macro on a different sheet
 
I'm stuck on this one. Basically, I have one spreadsheet
that when it opens, it will automatically open another spreadsheet.
Then what I'd like to have happen is to have a macro run on that newly
opened spreadsheet.

Example: test.xls is opened and through OpenNew macro, another
spreadsheet called target.xls is opened. I then need a macro
Refresh_Data on target.xls to run.

I don't want to have anything written into target.xls to automatically
run Refresh_Data when the spreadsheet is opened however since other
people open and work with it. I need to have Target.xls opened and
the Refresh_Data macro run by having something written into text.xls.

Does that make sense? If there is an easier method than what I was
thinking of, please recommend.

Thanks in advance.

Paul

Chip Pearson

How do I Launch a Macro on a different sheet
 
Paul,

Use the Application.Run method. E.g.,

Application.Run "target.xls!Refresh_Data"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Pepe" wrote in message
om...
I'm stuck on this one. Basically, I have one spreadsheet
that when it opens, it will automatically open another

spreadsheet.
Then what I'd like to have happen is to have a macro run on

that newly
opened spreadsheet.

Example: test.xls is opened and through OpenNew macro, another
spreadsheet called target.xls is opened. I then need a macro
Refresh_Data on target.xls to run.

I don't want to have anything written into target.xls to

automatically
run Refresh_Data when the spreadsheet is opened however since

other
people open and work with it. I need to have Target.xls opened

and
the Refresh_Data macro run by having something written into

text.xls.

Does that make sense? If there is an easier method than what I

was
thinking of, please recommend.

Thanks in advance.

Paul





All times are GMT +1. The time now is 06:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com