ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Buttons (https://www.excelbanter.com/excel-programming/405665-buttons.html)

ranswert

Buttons
 
How do I identify a range of cells that a button is in when it is clicked?
Thanks

Andy Pope

Buttons
 
Hi,

This will report cells covered by a button from the Forms toolbar.

Sub Button3_Click()

With ActiveSheet.Shapes(Application.Caller)
MsgBox "Button is over cells " & _
.TopLeftCell.Address & ":" & _
.BottomRightCell.Address
End With

End Sub

Cheers
Andy

ranswert wrote:
How do I identify a range of cells that a button is in when it is clicked?
Thanks


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

ranswert

Buttons
 
Thank You for the help

"Andy Pope" wrote:

Hi,

This will report cells covered by a button from the Forms toolbar.

Sub Button3_Click()

With ActiveSheet.Shapes(Application.Caller)
MsgBox "Button is over cells " & _
.TopLeftCell.Address & ":" & _
.BottomRightCell.Address
End With

End Sub

Cheers
Andy

ranswert wrote:
How do I identify a range of cells that a button is in when it is clicked?
Thanks


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



All times are GMT +1. The time now is 04:19 PM.

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