![]() |
Excel Shapes
Is there a way reference a excel shape with a macro attached to it when you
have clicked onto it? |
Excel Shapes
Jason,
Application.Caller will return a text string with the name of the shape. Thus, you can get a reference through the Shapes collection. E.g., MsgBox ActiveSheet.Shapes(Application.Caller).Name -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Jason Zischke" wrote in message ... Is there a way reference a excel shape with a macro attached to it when you have clicked onto it? |
Excel Shapes
Option Explicit
Sub testme() Dim myShp As Shape Set myShp = ActiveSheet.Shapes(Application.Caller) With myShp MsgBox .Name & vbLf & .TopLeftCell.Address & vbLf & .Name End With End Sub Jason Zischke wrote: Is there a way reference a excel shape with a macro attached to it when you have clicked onto it? -- Dave Peterson |
Excel Shapes
Some additional macros working with Shapes, but not
from a macro attached to the shape, like you asked and Dave answered, but you might find something you want to add to Dave's example. http://www.mvps.org/dmcritchie/excel/shapes.htm --- HTH, David McRitchie, Microsoft MVP - Excel My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm |
Excel Shapes
Yes
Right click on the excel shape, select Attach Macro. Assign the corresponding macro. When you move the mouse over the shape a hand will appear. Click to run the attached macro. "Jason Zischke" wrote: Is there a way reference a excel shape with a macro attached to it when you have clicked onto it? |
All times are GMT +1. The time now is 12:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com