none
Button RRS feed

  • Question

  • I created a spreadsheet with 5 active X buttons that work. I also created another Active X button on the same spreadsheet. What I like to know is how to create a macros (or any other way) to activate that one button to trigger the other 5 Active X buttons.I'm working with Excel 2016. How can I do this?

    Monday, December 21, 2015 9:58 PM

Answers

  • Like the following

    Private Sub CommandButton5_Click()
        Call CommandButton1_Click
        Call CommandButton2_Click
        Call CommandButton3_Click
        Call CommandButton4_Click
    End Sub


    Regards, OssieMac

    • Proposed as answer by David_JunFeng Tuesday, December 22, 2015 4:27 AM
    • Marked as answer by David_JunFeng Tuesday, January 5, 2016 1:32 AM
    Tuesday, December 22, 2015 3:35 AM

All replies

  • Like the following

    Private Sub CommandButton5_Click()
        Call CommandButton1_Click
        Call CommandButton2_Click
        Call CommandButton3_Click
        Call CommandButton4_Click
    End Sub


    Regards, OssieMac

    • Proposed as answer by David_JunFeng Tuesday, December 22, 2015 4:27 AM
    • Marked as answer by David_JunFeng Tuesday, January 5, 2016 1:32 AM
    Tuesday, December 22, 2015 3:35 AM
  • Thank you for your quick response OssieMac. I'll give it a shot and see what happens(I'm sure it will be fine). As you can tell I'm a rookie at this.

    Thank you again

    Regards

    What's the answer



    Tuesday, December 22, 2015 5:10 PM
  • Private Sub CommandButton5_Click()
        CommandButton1.value=true
        CommandButton2.value=true
        CommandButton3.value=true
        CommandButton4.value=true
    End Sub
    Tuesday, December 22, 2015 6:49 PM
  • Hi OssieMac,

    Thanks again for your help, IT WORKS PERFECTLY!. Just what I needed it to do.

    Hope you'll allow me to ask more questions in solving my future problems.

    Once again, Thank you!

    Regards

    What's the answer

    Tuesday, December 22, 2015 6:50 PM
  • Thank you Juan in helping me solve my problem.

    What would be the difference in using the ".value=true" method as you suggested

    as apposed to the"_click" method? As for now OssieMac has solved my concern.

    Please respond, this could be something that I will need in future code.

    Thank You

    What's the answer

    Wednesday, December 23, 2015 1:44 AM
  • When you want to run a macro from an event or from another macro in the same workbook you can call the macro like this in your code :

    Call YourMacroName

    You do not have to use Call but I think it is clearer when you read the code that another macro is called.

    But what if you want to run a macro that is in another workbook or Add-In(File or add-in must be open).
    We can use Application.Run if we want that like this :

    Application.Run "Book1.xls!MyMacroName"
    Wednesday, December 23, 2015 7:41 AM
  • Thank you for getting back to me and explaining the difference. I appreciate all the help. I'll get to you and OssieMac for further help.

    Once again, Thank You

    What's the answer

    Thursday, December 24, 2015 4:58 PM