+ Reply to Thread
Results 1 to 6 of 6

Hiding buttons/showing them

  1. #1
    Registered User
    Join Date
    01-14-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    72

    Hiding buttons/showing them

    Hi there

    In my sheet, I've got a command button that protects the sheet and unprotects it (code was thanks to this forum) and I'd like to make it so that when the sheet is protected, all the other command buttons are hidden (CommandButton1 to CommandButton5) and then when the sheet is unprotected again, the buttons all show up.

    The reason for this is because when other buttons are clicked as the sheet is protected, it brings up the error and shows Debug as an option and then the user can click that to look at the code and password for the protect sheet button.

    Thanks for your help.
    Last edited by torontoguy; 02-02-2009 at 10:14 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Hiding buttons/showing them

    First, you can keep your code hidden from eyes by protecting the code inside the VBEditor. I use 2003, not 2007 like you have listed, but look in the VBE and you'll find a way to lock your code from prying eyes.
    Last edited by JBeaucaire; 01-28-2009 at 02:26 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Hiding buttons/showing them

    Second, you can try these two pieces of code to insert in your code:

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 01-28-2009 at 02:26 PM.

  4. #4
    Registered User
    Join Date
    01-14-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    72

    Re: Hiding buttons/showing them

    Please Login or Register  to view this content.
    and i'll take a look at the vba protector

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Hiding buttons/showing them

    Careful here, you stated you wanted to HIDE buttons 1-5, but your code indicates that button1 is the one doing the protecting/unprotecting. In that case, you really only want to hide buttons 2-5? I'll assume so.

    Anyway, if the buttons are on the same page, then:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-14-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    72

    Re: Hiding buttons/showing them

    alright

    will try this out asap
    thanks!

+ 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