![]() |
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 |
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 |
All times are GMT +1. The time now is 09:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com