+ Reply to Thread
Results 1 to 13 of 13

Lock/unlock cell range based on cell value

  1. #1
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Lock/unlock cell range based on cell value

    I want to lock/unlock a range of cells (10-76) based on the value of cell 8

    I've figured out how to lock/unlock one column of cells based on the value of a specific target cell using the following formula:
    Please Login or Register  to view this content.
    But what I'm having difficulty with is figuring out how to apply this to the rest of my columns (F-P) so that if E8="Actuals" the cells in that column will unlock and if F8="Actuals" the cells in that column will unlock, and so on.

    Thanks in advance!

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Lock/unlock cell range based on cell value

    Maybe

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Lock/unlock cell range based on cell value

    Nope, that didn't work. I'm thinking it might be something close to my original code, but possibly using mycell.column?

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Lock/unlock cell range based on cell value

    Quote Originally Posted by AAnderson4912 View Post
    Nope, that didn't work. I'm thinking it might be something close to my original code, but possibly using mycell.column?
    You can surely try that, but in my test in worked fine. How are you determining if it's working or not. I suspect after you enter "Actuals" in E8, Right Click within the range to see if the lock is cycling.

    If you are basing the actions off of E8, there isn't anything to Calculate. That's just a worksheet change event.

  5. #5
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Lock/unlock cell range based on cell value

    Oh, well 2 points of clarification:

    1) I used the Calculate function because cells E8-P8 will change based on a formula triggered by another cell (no manual entry).
    2) Your code seems to be unlocking all the cells in the range (E10-P76) based on the value of E8. What I want to do is only unlock those cells in the corresponding column. So if E8=Actuals, it'll unlock E10-E76, and if F8=Actuals it'll unlock F10-F76, and so on.

    Does that make sense?

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Lock/unlock cell range based on cell value

    Ok yes, that makes more sense as you didn't initially describe any cell outside of E8. Do you have a mocked up example you can attach?

  7. #7
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Lock/unlock cell range based on cell value

    Yes, this should help illustrate what I'm trying to do.
    Attached Files Attached Files

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Lock/unlock cell range based on cell value

    It's password protected.

  9. #9
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Lock/unlock cell range based on cell value

    You can just unlock, there is no password.

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Lock/unlock cell range based on cell value

    See how this works for you. It uses C4 to trigger then event and then checks for the word "Actuals" in row 8.

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Lock/unlock cell range based on cell value

    That seemed to do the trick. Thanks so much for your help!

  12. #12
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Lock/unlock cell range based on cell value

    You are very welcome and thanks for the feedback.

  13. #13
    Registered User
    Join Date
    07-10-2019
    Location
    New York, NY
    MS-Off Ver
    MS Office 2016
    Posts
    31

    Re: Lock/unlock cell range based on cell value

    There are probably more elegant ways to do it, but I also figured out a way to achieve the same result based on a calculated cell.
    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. Replies: 1
    Last Post: 05-11-2015, 06:02 PM
  2. Lock/Unlock a cell based on the value selected from drop down in adjacent cell
    By mahesnrm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2013, 08:28 AM
  3. Replies: 1
    Last Post: 09-12-2013, 10:38 PM
  4. Lock and unlock a cell or two cells based on a value of another cell
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2013, 07:34 PM
  5. How to Lock/Unlock a Cell Based on the Contents of Another Cell?
    By bbright1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-24-2013, 11:20 AM
  6. Unlock / Lock cell based on another cel value
    By BernardTodd in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-13-2013, 10:38 AM
  7. How to lock and unlock a range of cells based on certain cell's value?
    By potato in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-25-2012, 04:34 AM

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