Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retrieving name from command button on Worksheet
I'm using Excel 2000 under win2K and have several command buttons on a
worksheet and assigned the same macro to them. In the macro I want to find out WHAT button has been clicked (extracting a number I attached to a name to privide as parameter in a function). I don't want to create a bunch of macro's just to identify each command button separately. How do I do that? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retrieving name from command button on Worksheet
If you are using buttons from the Forms toolbar then
"Application.Caller" returns a string with the button name. Extracting a single digit suffix from the button name could work like this... Sub CommonSubCalledByAllButtons() Select Case Right$(Application.Caller, 1) Case "1" 'do something Case "2" 'don't do something Case "3" 'do something else Case "4" 'have lunch End Select End Sub -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware wrote in message oups.com... I'm using Excel 2000 under win2K and have several command buttons on a worksheet and assigned the same macro to them. In the macro I want to find out WHAT button has been clicked (extracting a number I attached to a name to privide as parameter in a function). I don't want to create a bunch of macro's just to identify each command button separately. How do I do that? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command Button on worksheet | Excel Programming | |||
command button on worksheet | Excel Programming | |||
Command Button to Hyperlink to a Different worksheet | Excel Programming | |||
How do I add a command button on a worksheet to "paste" from the . | Excel Worksheet Functions | |||
Command button on a protected worksheet | Excel Programming |