ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine which button was clicked on a sheet (https://www.excelbanter.com/excel-programming/411553-re-determine-button-clicked-sheet.html)

Paul D Byrne.

Determine which button was clicked on a sheet
 
Hi Tom,

This post answered my question - wanted to do the same thing. Which was
great, however when I try to get help on 'Buttons' Excel comes back with :

"Hidden Language Element
You have requested Help for a language element that is hidden, and therefore
unavailable for programmatic access. "

which is a bummer as if there is a buttons object that would be so much
simpler than mucking around with shapes.

any ideas on why excel is 'hidding' a button object?

cheers,

Paul B.



"Tom Ogilvy" wrote:

Sub Btn_click()
Dim sBtnName as String
Dim btn as Button
sBtnName = Application.Caller
set btn = Activesheet.buttons(sBtnName)
msgbox btn.Caption
End Sub

--
Regards,
Tom Ogilvy

"XP" wrote:

I have several regular buttons (i.e. not an activeX button) control on a
sheet. All of these buttons run the same user form, but I want the results
placed into separate cells depending upon which button was clicked to load
the form.

Using VBA, can someone please post example code that determines which button
was clicked on the sheet, using the button's caption as the defining variable?

Thanks in advance.



All times are GMT +1. The time now is 11:12 AM.

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