Auto shape macro

M

maxfoo

Q:
When using several Auto shape objects in a worksheet and inserting a macro to
each, is there a way to tell which shape was run by the user at run time?


tia,




Remove "HeadFromButt", before replying by email.
 
C

Chip Pearson

The Application.Caller property will return the name of the shape
that was clicked to execute the macro. So in your assigned macro,
use code like

Dim SH As Shape
Set SH = ActiveSheet.Shapes(Application.Caller)
MsgBox SH.Name



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
M

maxfoo

The Application.Caller property will return the name of the shape
that was clicked to execute the macro. So in your assigned macro,
use code like

Dim SH As Shape
Set SH = ActiveSheet.Shapes(Application.Caller)
MsgBox SH.Name



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


Thanks Chip,

Is there an easy way to rename each autoshape? The default is
"AutoShape 1" I can't seem to find a property box for them, right clicking on
the object shows a format autoshape option, but the property tab only gives you
the option buttons for positioning the object. thanks...





Remove "HeadFromButt", before replying by email.
 
C

Chip Pearson

Is there an easy way to rename each autoshape?

Yes. Select the shape object, and enter the new name in the Name
Box, at the left side of the screen next to the formula bar (the
area that normally shows the address of the currently selected
cell).


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




 
Top