Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sub CommandButton1 help | Excel Worksheet Functions | |||
Transfer Module1 from PC to Mac | Excel Programming | |||
Enable CommandButton1 | Excel Programming | |||
How do I label a command button so it doesn't say CommandButton1? | Excel Discussion (Misc queries) | |||
Run Module1 first then automatically run Module2 | Excel Programming |