Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Assign Worksheet Module to a Shape
Hi all, I have macro in Worksheet Module (see below)
Private Sub dd() ActiveSheet.Range("A1").Value = "OK" End Sub I have a Rectangle Shape on my sheet to which I gave the name "shp". I want to assign above macro to this shap by another macro and this macro I want to put in normal Module. The only problem is that I don’t want other macro which I'll put in normal Module to be like this (see below) Sub attch_maro() ActiveSheet.Shapes("shp").Select Selection.OnAction = "Sheet1.dd" End Sub I want other macro to be like this (see below) Sub attch_maro() ActiveSheet.Shapes("shp").Select Selection.OnAction = ActiveSheet.dd End Sub I tried this but for some reason I am getting error and it highlighting this line "Selection.OnAction = ActiveSheet.dd". Basically I want to assign activesheet macro to my shape. I hope I was able to explain my problem. Please can any friend can help |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to Assign Worksheet Module to a Shape
On Oct 23, 11:37*am, K wrote:
Hi all, *I have macro in Worksheet Module (see below) Private Sub dd() ActiveSheet.Range("A1").Value = "OK" End Sub I have a Rectangle Shape on my sheet to which I gave the name "shp". I want to assign above macro to this shap by another macro and this macro I want to put in normal Module. The only problem is that I don’t want other macro which I'll put in normal Module to be like this (see below) Sub attch_maro() ActiveSheet.Shapes("shp").Select Selection.OnAction = "Sheet1.dd" End Sub I want other macro to be like this (see below) Sub attch_maro() ActiveSheet.Shapes("shp").Select Selection.OnAction = ActiveSheet.dd End Sub I tried this but for some reason I am getting error and it highlighting this line "Selection.OnAction = ActiveSheet.dd". Basically I want to assign activesheet macro to my shape. *I hope I was able to explain my problem. *Please can any friend can help Maybe something like: Selection.OnAction = ActiveSheet.Name & ".dd" hth -scattered |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
assign excel 2003 macro with parms to shape | Excel Programming | |||
Calling worksheet module from other module. | Excel Programming | |||
Run worksheet module code from workbook module? | Excel Programming | |||
Assign Value to Module Level Variable | Excel Programming | |||
Assign code to shape | Excel Programming |