Auto shape macro

  • Thread starter Thread starter maxfoo
  • Start date Start date
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.
 
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
 
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.
 
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




 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top