Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
bz bz is offline
external usenet poster
 
Posts: 16
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Place a button on a worksheet and assign a macro to it? PFB New Users to Excel 7 December 18th 08 03:28 PM
How to insert a macro button in a worksheet laurlang Excel Discussion (Misc queries) 1 November 2nd 07 02:11 PM
Tooltip for macro button in a worksheet Manju Excel Worksheet Functions 0 February 1st 07 06:41 PM
Adding Macro to Button on WOrksheet Barb Reinhardt Excel Discussion (Misc queries) 1 January 21st 06 02:29 PM
How to end macro on inital active worksheet containing macro button that was clicked Silverhawk1 Excel Programming 2 May 14th 04 03:58 PM


All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"