+ Reply to Thread
Results 1 to 6 of 6

Unlock a cell based on checkbox value in another cell

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    3

    Unlock a cell based on checkbox value in another cell

    Hello.

    I have a protected sheet (no password) that I would like cell L7 to unlock if the checkbox in J7 is checked or remain locked if the box is not checked. I would like this to continue down the sheet; L8 unlocked if J8 is checked etc.

    Any help is much appreciated!!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Unlock a cell based on checkbox value in another cell

    Hi,

    You've complicated the process by using Check boxes. You could just as easily have had the user click in column J which could have triggered the relevant part of the following macro. This macro first has to identify where the checkbox is located and then lock/unlock the relevant cell. And of course you'll need to point all the checkboxes code to this Procedure.


    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-03-2013
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Unlock a cell based on checkbox value in another cell

    Thank you Richard.

    I tried pasting this code but the cell in column L did not unlock for editing when the checkbox was checked. If the checkboxes are complicating what I'm trying to do, would a yes/no dropdown in column J simplify it or no?

    -E

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Unlock a cell based on checkbox value in another cell

    Hi,

    Yes it's much simpler just to detect a cell change, or in this case a double click.

    I've removed the checkboxes from J6:J7 and removed the data validation to show you an alternative.
    Double clicking these cells will toggle a Y/N and Lock/Unlock the column L cell on the same row.

  5. #5
    Registered User
    Join Date
    07-03-2013
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Unlock a cell based on checkbox value in another cell

    Thanks again Richard. I agree the Y/N toggle will be simpler; thanks for the suggestion. However; when I opened the revised file, I'm not able to toggle the Y/N by double clicking. If I change the Y to N in J7, L7 does not unlock for editing. Perhaps I'm missing something?

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Unlock a cell based on checkbox value in another cell

    Hi,

    Toggling to N locks the L cell. It sounds like you want this the other way round. In which case just change the line in the
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    procedure

    Target.Cells(1, 3).Locked = True
    to
    Target.Cells(1, 3).Locked = False

    and the line
    Target.Cells(1, 3).Locked = False
    to
    Target.Cells(1, 3).Locked = True

+ 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