Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Put CommandButton1 code in Module1

Is there a way to have the command button execution code in Module1 instead
of in the worksheet. Currently the CommandButton1 code is:

Private Sub CommandButton1_Click()
ListsUpdate
End Sub

Where ListsUpdate is a macro in Module1.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Put CommandButton1 code in Module1

CommandButton1.Value = true

"DocBrown" wrote in message
...
Is there a way to have the command button execution code in Module1
instead
of in the worksheet. Currently the CommandButton1 code is:

Private Sub CommandButton1_Click()
ListsUpdate
End Sub

Where ListsUpdate is a macro in Module1.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Put CommandButton1 code in Module1

No, the event procedure code must reside in the code module of the object.
You can certainly put "ListUpdates" in Module1, but the actual click event
code must reside in the Sheet module of the sheet that contains the control.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

"DocBrown" wrote in message
...
Is there a way to have the command button execution code in Module1
instead
of in the worksheet. Currently the CommandButton1 code is:

Private Sub CommandButton1_Click()
ListsUpdate
End Sub

Where ListsUpdate is a macro in Module1.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Put CommandButton1 code in Module1

Maybe you could delete the commandbutton (from the Control toolbox toolbar) and
use a button from the Forms toolbar.

They look pretty much the same, but you assign the macro (in a General module)
to the button (rightclick on it, choose Assign Macro).

And you could delete the Button from that sheet.

worksheets("SomeNameHere").buttons(1).delete
or by name:
worksheets("SomeNameHere").buttons("myButtonNameHe re").delete



DocBrown wrote:

Is there a way to have the command button execution code in Module1 instead
of in the worksheet. Currently the CommandButton1 code is:

Private Sub CommandButton1_Click()
ListsUpdate
End Sub

Where ListsUpdate is a macro in Module1.


--

Dave Peterson
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
Sub CommandButton1 help Monty Excel Worksheet Functions 2 September 21st 07 11:50 AM
Transfer Module1 from PC to Mac Jim May Excel Programming 1 August 5th 06 06:39 PM
Enable CommandButton1 Terri Excel Programming 4 May 28th 06 01:00 PM
How do I label a command button so it doesn't say CommandButton1? [email protected] Excel Discussion (Misc queries) 2 December 10th 05 12:40 AM
Run Module1 first then automatically run Module2 [email protected] Excel Programming 4 September 20th 05 05:26 PM


All times are GMT +1. The time now is 11:59 AM.

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

About Us

"It's about Microsoft Excel"