+ Reply to Thread
Results 1 to 3 of 3

Disable or hide a recorded macro button when clicked if the worksheet is protected

  1. #1
    Registered User
    Join Date
    10-22-2013
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    17

    Disable or hide a recorded macro button when clicked if the worksheet is protected

    Hello,

    I have searched but did not find an answer which worked for me.

    I have buttons to sort a certain column from A to Z and another one to sort from Z to A, which work fine. But I would like these buttons to be disabled if the worksheet is protected, or hide them (which would be even better).

    I have tried to: right click the Button --> Format control --> Protection and set it to lock. But this has not worked.

    Any way this is possible to do?

    Thank you in advance.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Disable or hide a recorded macro button when clicked if the worksheet is protected

    The difficulty with hiding is that one would have to un-hide it when the user unprotects the sheet. Excel doesn't fire an event when a sheet is protected.

    The easiest way would be to put something like this in your sorting routine

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    10-22-2013
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Disable or hide a recorded macro button when clicked if the worksheet is protected

    Quote Originally Posted by mikerickson View Post
    The difficulty with hiding is that one would have to un-hide it when the user unprotects the sheet. Excel doesn't fire an event when a sheet is protected.

    The easiest way would be to put something like this in your sorting routine

    Please Login or Register  to view this content.

    Thank you a lot mikerickson, this works great .

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro To Open A Hidden Worksheet When Button (Form Control) Is Clicked
    By obwales in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-25-2012, 12:55 AM
  2. Hide command button if worksheet is protected
    By PRodgers4284 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 10-05-2009, 07:32 AM
  3. Protect a Worksheet (Disable Macro Button)
    By PRodgers in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2009, 10:21 AM
  4. Replies: 3
    Last Post: 09-18-2008, 12:07 PM
  5. disable command button once data is recorded
    By stoey in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-08-2008, 03:02 PM

Tags for this Thread

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