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/380538-re-determine-button-clicked-sheet.html)

Norman Jones

Determine which button was clicked on a sheet
 
Hi XP,

Try something like:

'=============
Public Sub Tester()
MsgBox Application.Caller
End Sub
'<<=============



---
Regards,
Norman



"XP" wrote in message
...
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.




Norman Jones

Determine which button was clicked on a sheet
 
Hi XP,

Just to add, having assigned this macro to each button of interest, clicking
the button will return a message comprising the button's name.


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi XP,

Try something like:

'=============
Public Sub Tester()
MsgBox Application.Caller
End Sub
'<<=============



---
Regards,
Norman



"XP" wrote in message
...
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 04:42 PM.

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