Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
activating a command button
I have a command button on sheet1 named george.
i want it to activate/run a command button on sheet2 named harry. can i do this? how? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
activating a command button
You have at least a couple of choices.
This is the code I used under the Sheet2 module. Option Explicit Sub George_Click() MsgBox "hi from George" End Sub Notice that the Private keyword is gone. That's so the "Call" can find the procedure. This is the code under the Sheet1 module: Option Explicit Private Sub Harry_Click() Call Sheet2.George_Click End Sub ========= Another way: Under Sheet2: Option Explicit Private Sub George_Click() MsgBox "hi from George" End Sub Notice that the Private keyword is back. And under Sheet1: Option Explicit Private Sub Harry_Click() Application.Run "Sheet2.George_Click" End Sub (in both of these cases, that Sheet2 is the code name for the sheet--not the name you see in excel on the sheet tab.) ======= And one more way: Under Sheet2: Option Explicit Private Sub George_Click() MsgBox "hi from George" End Sub Under Sheet1: Option Explicit Private Sub Harry_Click() Worksheets("Sheet2").OLEObjects("George").Object.V alue = True End Sub chuck wrote: I have a command button on sheet1 named george. i want it to activate/run a command button on sheet2 named harry. can i do this? how? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
command button add another command | Excel Discussion (Misc queries) | |||
Command Button | Excel Worksheet Functions | |||
Command Button | Excel Worksheet Functions | |||
How to add a command button | Excel Discussion (Misc queries) | |||
Command Button | Excel Worksheet Functions |