Alternate Button Macro & Caption Between 2

  • I have a worksheet with 2 buttons labelled "Hide" and "Show". As the names imply, they allow the user to hide or show parts of the worksheet. I would like to combine them into one button and have the button label and the associated macro change with each press of the button. Here is what I have so far;



    These macros change the label fine after hiding or unhding the rows but I can't find the proper terms to use to change the macro associated with the button (if there is one?)
    As always, your help is greatly appreciated!

  • Re: Alternate Between 2 Macros With One Button


    Try something like this:

  • Re: Alternate Between 2 Macros With One Button


    Nice job Simon. :razz: (BTW - "Option Explicit" got left out of the code tags)


    Just to state what may not be obvious to the OP - to use this code, you must use it with a button created from the Control Toolbox, not a button created from the Forms Toolbar.

  • Re: Alternate Between 2 Macros With One Button


    Quote from AAE

    Nice job Simon. (BTW - "Option Explicit" got left out of the code tags)

    Thanks and fixed, as for the "Button" i should have stated that but there again the user can adapt the idea of the code to their particular button!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!