View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sunny Sunny is offline
external usenet poster
 
Posts: 42
Default 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.