ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifying the selected Shape (https://www.excelbanter.com/excel-programming/336599-identifying-selected-shape.html)

Jerry[_20_]

Identifying the selected Shape
 
I have lots of buttons on a sheet. They all start the same sub. How can
I tell which button was clicked? I'd like to get the underlying row. I
see the TopLeftCell method, but I don't know how to tell which is the
selected Shape.

Thanks for helping;
Jerry


Greg Wilson

Identifying the selected Shape
 
Try:

Sub GetTopLeftCell()
With ActiveSheet.Shapes(Application.Caller)
MsgBox .Name & vbCr & .TopLeftCell.row
End With
End Sub

Regards,
Greg

"Jerry" wrote:

I have lots of buttons on a sheet. They all start the same sub. How can
I tell which button was clicked? I'd like to get the underlying row. I
see the TopLeftCell method, but I don't know how to tell which is the
selected Shape.

Thanks for helping;
Jerry




All times are GMT +1. The time now is 09:31 AM.

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