PDA

View Full Version : check which cmd buttons is clicked



run_user
04-15-2008, 09:20 AM
What is the code to check which of two cmd buttons is clicked, and accordingly invoke a function?

lucas
04-15-2008, 01:17 PM
Why not use a toggle button? What application is this for Word, Excel?

run_user
04-15-2008, 01:37 PM
this is in excel, I have 2 buttons, both invoke calendars, but depending on which button is clicked, the date is entered into a specified cell.

lucas
04-15-2008, 03:23 PM
I would need a little more information before I could help you much. The first question that comes to mind is why not "invoke the function" on button click. Unless I am not understanding you, I'm not sure what you mean by "invoke the function"

Are the buttons on a sheet or a userform?


Thread moved to the Excel help forum..You will stand a better chance of getting help in the appropriate forum...

mikerickson
04-15-2008, 05:40 PM
If it is a commandbutton on a spreadsheet

MsgBox "The Command Button named " & Application.Caller & " was pressed."

Trevor
04-15-2008, 05:49 PM
you could also pass a variable to a select case and display the result in a cell. don't know what your trying to use it for to be of much more help