![]() |
Run Macro in one worksheet from a button on another worksheet
To all,
I have written a macro that does various things in a worksheet called DATA. At the moment I am running in by using a button in this worksheet, so that when the user clicks it, it runs. However I wish to place a button on the main worksheet called WELCOME and to run the macro in the DATA spreadsheet. Is it possible to do this without rewriting the macro that I have in the DATA worksheet? Thanks in advance, Regards Joseph Crabtree |
Run Macro in one worksheet from a button on another worksheet
As the macro executes, it needs to know on what sheet to perform its
operations: Sub demo() Dim ws As Worksheet Set ws = Sheets("DATA") ws.Range("A1").Value = 1 End Sub tells the macro that DATA is the sheet to change, not the ActiveSheet. -- Gary's Student "joecrabtree" wrote: To all, I have written a macro that does various things in a worksheet called DATA. At the moment I am running in by using a button in this worksheet, so that when the user clicks it, it runs. However I wish to place a button on the main worksheet called WELCOME and to run the macro in the DATA spreadsheet. Is it possible to do this without rewriting the macro that I have in the DATA worksheet? Thanks in advance, Regards Joseph Crabtree |
Run Macro in one worksheet from a button on another worksheet
"joecrabtree" wrote in
ps.com: To all, I have written a macro that does various things in a worksheet called DATA. At the moment I am running in by using a button in this worksheet, so that when the user clicks it, it runs. However I wish to place a button on the main worksheet called WELCOME and to run the macro in the DATA spreadsheet. Is it possible to do this without rewriting the macro that I have in the DATA worksheet? If your macro is NOT 'private' you should be able to access it from any sheet in the workbook. Have you tried attaching it to a button on the WELCOME worksheet? -- bz please pardon my infinite ignorance, the set-of-things-I-do-not-know is an infinite set. remove ch100-5 to avoid spam trap |
All times are GMT +1. The time now is 02:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com