+ Reply to Thread
Results 1 to 12 of 12

How to make a commandbutton show in all sheets?

  1. #1
    Registered User
    Join Date
    02-02-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    47

    How to make a commandbutton show in all sheets?

    Hey,

    can someone tell me how I make buttons show in all sheets and in all newly created sheets?

    I have about 10 sheets wit the same commandbuttons with these same codes asigned to them by copying these codes for every sheet.

    Please Login or Register  to view this content.
    Can I not put these codes in the "This workbook" and only make these commandbuttons on sheet1. So all the other sheets display these buttons to and also work with the codes?
    Last edited by Bluewhistler; 04-14-2010 at 11:16 AM. Reason: Solved by romperstomper

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: How to make a commandbutton show in all sheets?

    No, that wouldn't work. Why not put the button on a toolbar instead - then you only need one?
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    02-02-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: How to make a commandbutton show in all sheets?

    This workbook is used by several ppl here on different computer.

    To bad though,

    can I atleast make the buttons activate the codesfrom within "Thisworkbook" so I don't have to copy all the codes to every sheet?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: How to make a commandbutton show in all sheets?

    That doesn't matter. You can have the workbook create the button when it's opened and delete it again when closed? Would that work for you?

  5. #5
    Registered User
    Join Date
    02-02-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: How to make a commandbutton show in all sheets?

    Quote Originally Posted by romperstomper View Post
    That doesn't matter. You can have the workbook create the button when it's opened and delete it again when closed? Would that work for you?
    Do you mean the toolbarbuttons?
    That sounds like its going to hurt? But I'm willing to try out if you can lead the way a bit?

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: How to make a commandbutton show in all sheets?

    You will need to move your code to a macro in a normal module. Then add a new normal module and paste this in - you need to alter the caption and macro name constants at the top as necessary:
    Please Login or Register  to view this content.
    then in the ThisWorkbook module you need code like this:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-02-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: How to make a commandbutton show in all sheets?

    I managed to get this working. Realy amaizing
    But this only loads one button? how can i make all the buttons load
    I allready made 7 toolbar buttons.

    thx

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: How to make a commandbutton show in all sheets?

    If you need more than one button, then you need multiple passes of this bit of the code:
    Please Login or Register  to view this content.
    changing the caption and macro name each time (or use the same macro and pass different parameters).
    Without really knowing the details of what you are doing, I can't be more specific.

  9. #9
    Registered User
    Join Date
    02-02-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: How to make a commandbutton show in all sheets?

    Please Login or Register  to view this content.
    I get more buttons but they state all false?

    UPDATE: allright I got it working
    thx man
    Last edited by Bluewhistler; 04-14-2010 at 11:11 AM. Reason: thank man

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: How to make a commandbutton show in all sheets?

    You shouldn't have the constant in there:
    Please Login or Register  to view this content.

  11. #11
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,008

    Re: How to make a commandbutton show in all sheets?

    FYI, for multiple buttons, you might want to have a look at this article by John Walkenbach for a table-driven approach.

  12. #12
    Registered User
    Join Date
    02-02-2010
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: How to make a commandbutton show in all sheets?

    I was able to get it working thanks for your help man.

    This is much better than what i dit and much much faster!

    I'll look into that artickle.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1