+ Reply to Thread
Results 1 to 9 of 9

Display text in a cell according to a sheet's protected or unprotected status

  1. #1
    Registered User
    Join Date
    09-21-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    30

    Display text in a cell according to a sheet's protected or unprotected status

    Hello forum,

    This is a follow on from an earlier thread... http://www.excelforum.com/excel-form...ml#post3988658
    As I marked that thread solved and this question is new I thought it would be the correct protocol to start a new thread.
    I was kindly provided with the following code:


    Please Login or Register  to view this content.

    I am trying to write a formula that will display text in a cell according to the protected status of the sheet but I can't get it to work...
    =IF(ISSHEETPROTECTED(), "Sheet Protected", "WARNING Sheet Unprotected")
    Can anyone help correct it?

    Many thanks.
    Dean.
    Last edited by DeanExcel; 02-16-2015 at 09:51 AM.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,293

    Re: Display text in a cell according to a sheet's protected or unprotected status

    Dean,

    Changing the protection on a sheet does not force a re-calc, so you need to use Ctrl-Alt-F9 or one of the variants to see the change.

    Also, I would change the function definition to this, because Activesheet may not be the sheet with the function when the re-calc is performed:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    09-21-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Display text in a cell according to a sheet's protected or unprotected status

    Many thanks Bernie,

    I have upgraded the function definition as per your recommendation.

    So the problem was the forced re-calc... (the conditional formating I applied to the cell worked without the recalc but not the formula).

    Is there a way of automatically forcing a re-calc or will I have to do it manually every time?

    Dean.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,293

    Re: Display text in a cell according to a sheet's protected or unprotected status

    You could use an event to force a re-calc, or the code that you use to protect the sheet -or write a macro to protect/unprotect the sheet ans use it to force the re-calc, or just write the value into the cell of interest. Why would you not know that the sheet is un/protected?

  5. #5
    Registered User
    Join Date
    09-21-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Display text in a cell according to a sheet's protected or unprotected status

    Hi Bernie, 29 years ago I started working on a financial management program "on paper" for personal use, anyway it has grown somewhat and people around me are interested in it! I have accidently messed up formulas and not noticed until a number of 'saves' later! Also I am testing it with some people and I keep tweaking it and forgetting to protect the pages and they enter data in the wrong places so I am creating the notification so I don't accidently bugger it up (my mouse was playing up the other day so it double clicked something - I didn't want to save the changes I made so I hit close and where prompted as to whether I want to save I was going to hit no but the second click hit yes! ) I think I will leave it at writing the value into the cell of interest... I guess I will know as soon as I protect or unprotect as I just did it and will be reminded as soon as I enter data. Many thanks again. Dean.

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,293

    Re: Display text in a cell according to a sheet's protected or unprotected status

    I have that same problem - and I use the workbook open event to turn on protection for everybody else and remove it for me:

    Please Login or Register  to view this content.
    Un/ProtectSheets turns the protection off/on for the sheets with formulas that I want to protect.

  7. #7
    Registered User
    Join Date
    09-21-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003
    Posts
    30

    Re: Display text in a cell according to a sheet's protected or unprotected status

    Thanks Bernie, that is an ideal way to solve a problem... I have tried it out and I must be doing something wrong...

    Please Login or Register  to view this content.
    I received the following message...
    Compile error:
    Expected: Then or GoTo

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,293

    Re: Display text in a cell according to a sheet's protected or unprotected status

    You left out the Like operator - or you can use =

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,293

    Re: Display text in a cell according to a sheet's protected or unprotected status

    You left out the Like operator - or you can use = like this - But make sure you have your exact username for the comparison


    Please Login or Register  to view this content.
    If you aren't sure of your username, then use

    Please Login or Register  to view this content.

+ 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] Visually show a SHEET'S Protected or Unprotected status.
    By DeanExcel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-13-2015, 10:11 AM
  2. Replies: 3
    Last Post: 10-23-2012, 04:42 AM
  3. [SOLVED] Select Next Unprotected Cell of Protected Sheet
    By walkerj1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2012, 04:12 PM
  4. Replies: 4
    Last Post: 07-04-2006, 09:45 AM
  5. [SOLVED] Adding comments to unprotected cell in a protected sheet
    By Dave in forum Excel General
    Replies: 3
    Last Post: 02-08-2006, 07:10 PM

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