Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling/running a macro on another worksheet
Lets say I have a CommandButton (call it Button1) on Sheet1 that does some
calculations using cells on Sheet1 and Sheet2 On Sheet2 I have another CommandButton (call it Button2) that alters some of the cells that are used when Button1 is clicked. I would like to add a macro to Sheet2 so that I could run the "CommandButton_Click()" macro on Sheet1. What would be the syntax for doing this? Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling/running a macro on another worksheet
Hi Sunny,
Try something like: '============= Public Sub Tester() Dim SH As Worksheet Dim oleObj As OLEObject Set SH = ThisWorkbook.Sheets("Sheet1") Set oleObj = SH.OLEObjects("CommandButton1") oleObj.Object.Value = True End Sub '<<============= --- Regards, Norman "Sunny" wrote in message ... Lets say I have a CommandButton (call it Button1) on Sheet1 that does some calculations using cells on Sheet1 and Sheet2 On Sheet2 I have another CommandButton (call it Button2) that alters some of the cells that are used when Button1 is clicked. I would like to add a macro to Sheet2 so that I could run the "CommandButton_Click()" macro on Sheet1. What would be the syntax for doing this? Thanks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
calling/running a macro on another worksheet
Thanks for the help, Norman. Does exactly what I needed it to.
"Norman Jones" wrote: Hi Sunny, Try something like: '============= Public Sub Tester() Dim SH As Worksheet Dim oleObj As OLEObject Set SH = ThisWorkbook.Sheets("Sheet1") Set oleObj = SH.OLEObjects("CommandButton1") oleObj.Object.Value = True End Sub '<<============= --- Regards, Norman "Sunny" wrote in message ... Lets say I have a CommandButton (call it Button1) on Sheet1 that does some calculations using cells on Sheet1 and Sheet2 On Sheet2 I have another CommandButton (call it Button2) that alters some of the cells that are used when Button1 is clicked. I would like to add a macro to Sheet2 so that I could run the "CommandButton_Click()" macro on Sheet1. What would be the syntax for doing this? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calling a macro from Worksheet--Activate | Excel Discussion (Misc queries) | |||
Report with macro losing links to a particular worksheet after running macro | Excel Programming | |||
calling worksheet function from a macro | Excel Worksheet Functions | |||
Program calling up Excel - Not running Macro | Excel Programming | |||
Calling a macro in another worksheet | Excel Programming |