ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shape Selection Name (https://www.excelbanter.com/excel-programming/340087-shape-selection-name.html)

tom

Shape Selection Name
 
I have several shapes on a spreadsheet that I want to assign a common macro,
but within the macro I need to know the shape location.

I need to know how to find XXX (the shape name or index) to get it to a
location

Sub box_select()
Set Sx = ActiveSheet
Lx = Sx.Shapes(XXX).TopLeftCell.Address
Range(Lx).Select
End Sub

Thanks.

Tom

Peter T

Shape Selection Name
 
Hi Tom,

Dim XXX as string
XXX = Application.Caller

Also have a look at Application.Goto(ref, true/false)

Regards,
Peter


"Tom" wrote in message
...
I have several shapes on a spreadsheet that I want to assign a common

macro,
but within the macro I need to know the shape location.

I need to know how to find XXX (the shape name or index) to get it to a
location

Sub box_select()
Set Sx = ActiveSheet
Lx = Sx.Shapes(XXX).TopLeftCell.Address
Range(Lx).Select
End Sub

Thanks.

Tom




Dave Peterson

Shape Selection Name
 
You have a macro that's assigned to the shape and you want to know what shape
was clicked?

Lx = Sx.Shapes(application.caller).TopLeftCell.Address

Tom wrote:

I have several shapes on a spreadsheet that I want to assign a common macro,
but within the macro I need to know the shape location.

I need to know how to find XXX (the shape name or index) to get it to a
location

Sub box_select()
Set Sx = ActiveSheet
Lx = Sx.Shapes(XXX).TopLeftCell.Address
Range(Lx).Select
End Sub

Thanks.

Tom


--

Dave Peterson


All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com