+ Reply to Thread
Results 1 to 9 of 9

How to lock previously unlocked cells on a protected worksheet

Hybrid View

  1. #1
    Registered User
    Join Date
    03-06-2008
    Posts
    20

    How to lock previously unlocked cells on a protected worksheet

    Please help. A password protected monthly worksheet contains unlocked cells for users enter value. How to make all cells on the worksheet locked automatically and not allow any data input in next month? There is a date cell on each worksheet, how to make every worksheet protected in next month?

    Thank you very much for your help.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-26-2012
    Location
    Kitchener, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: How to lock previously unlocked cells on a protected worksheet

    Do you want to use one macro to lock all sheets at once?

    Here an example for locking and protecting all sheets at once. You can modify it to make it work for specific sheet (without loop)
    Sub LockAllSheets()
        For Each Sh In ThisWorkbook.Sheets
            bVisible = Sh.Visible
            If Sh.Visible <> xlSheetVisible Then Sh.Visible = xlSheetVisible
            Sh.Unprotect "Pwd"
            Sh.Cells.Locked = True
            Sh.Protect "Pwd"
            Sh.Visible = bVisible
        Next Sh
    End Sub
    Last edited by aelgadi; 12-06-2012 at 04:00 PM. Reason: Spelling and re-phrasing
    aelgadi

    > Click Star if I helped. Thanks

  3. #3
    Registered User
    Join Date
    03-06-2008
    Posts
    20

    Re: How to lock previously unlocked cells on a protected worksheet

    Quote Originally Posted by aelgadi View Post
    Do you want to use one macro to lock all sheets at one?
    No. I want each sheet that not belongs to the current month automatically locked itself in the current month. That way the current month worksheets are still available for data input.

    Thank you very much for your help!!!!

  4. #4
    Registered User
    Join Date
    11-26-2012
    Location
    Kitchener, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: How to lock previously unlocked cells on a protected worksheet

    But you need to triger the macro that lock past month somehow let's say for example when you insert a new sheet or when save the document what you think?
    Last edited by aelgadi; 12-06-2012 at 04:42 PM. Reason: Spelling and re-phrasing

  5. #5
    Registered User
    Join Date
    03-06-2008
    Posts
    20

    Re: How to lock previously unlocked cells on a protected worksheet

    Thank you for helping me. The workbook is protected so no new sheet is allowed. I would prefer all past months sheets locked when user opens the workbook. Thank you.

  6. #6
    Registered User
    Join Date
    11-26-2012
    Location
    Kitchener, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: How to lock previously unlocked cells on a protected worksheet

    >>> If satisfied with a solution, don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

    >>> Thanks who helped by clicking the star below the post.

+ 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