ExcelBanter

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

sausepan

buttons
 
When I click a control button, I want to assigned macro
to recognize the button's name. Any ideas how?

ForSale[_49_]

buttons
 
You mean like have the button call the macro
Private Sub CommandButton1_Click()
Call Macro1
End Su

--
Message posted from http://www.ExcelForum.com


sausepan

buttons
 
I mean that if the button is named "delete 1" that the
macro can identify the button name.....ie.
x = button name
range ("a1").value = x

-----Original Message-----
You mean like have the button call the macro
Private Sub CommandButton1_Click()
Call Macro1
End Sub


---
Message posted from http://www.ExcelForum.com/

.


ForSale[_51_]

buttons
 
not tested, but try something like.
range("a1").value = delete1.name

i don't believe that you can have a space in the name of a button, d
you mean the caption? if you want it to return the caption try:
range("a1").value = commandbutton1.captio

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 02:51 AM.

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