Consulting

Results 1 to 6 of 6

Thread: check which cmd buttons is clicked

  1. #1

    check which cmd buttons is clicked

    What is the code to check which of two cmd buttons is clicked, and accordingly invoke a function?

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Why not use a toggle button? What application is this for Word, Excel?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    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.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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...
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    If it is a commandbutton on a spreadsheet

    [VBA]MsgBox "The Command Button named " & Application.Caller & " was pressed."[/VBA]

  6. #6
    VBAX Mentor
    Joined
    Dec 2007
    Posts
    462
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •