+ Reply to Thread
Results 1 to 7 of 7

Lock row based on one cells value

  1. #1
    Registered User
    Join Date
    07-15-2019
    Location
    USA
    MS-Off Ver
    365
    Posts
    19

    Lock row based on one cells value

    Im looking to be able to lock a row based on a cells value.

    If CELL AC7 = a value of "RETURNED" I would like to lock Cells A7:AB7 that would require the sheet to be unprotected to make changes.

    I need to repeat this for all rows on the sheet starting at row 7. Any help would be greatly appreciated.

  2. #2
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,400

    Re: Lock row based on one cells value

    Please copy this code in your active worksheet

    HTML Code: 
    Did I help significantly? If you wish, click on * Add Reputation to say thanks.
    If your problem has been resolved please select “Solved” from the Thread Tools menu

  3. #3
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Lock row based on one cells value

    Apply the following code, but first you must unlock all the cells in the worksheet(Select all cells, rt clck->Format, Select Protection tab, deselect Locked). And place code in the worksheet module. Let us know if you have questions.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,400

    Re: Lock row based on one cells value

    Unlock cell pls use this code

    HTML Code: 

  5. #5
    Registered User
    Join Date
    07-15-2019
    Location
    USA
    MS-Off Ver
    365
    Posts
    19

    Re: Lock row based on one cells value

    I cant seem to get that to work. i attached the file im working with right now. you will see each row at column AC has a drop down. if the drop down is changed to(RETURNED, DESTROYED, DONATED) it should lock that row from editing and need a password to be able to. If the column is empty or shows SECURED it could still be edited. i hope this makes sense. Thank you for your help
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-15-2019
    Location
    USA
    MS-Off Ver
    365
    Posts
    19

    Re: Lock row based on one cells value

    I did get this to work. Thank you very much. can you tell me though if column AC has either (RETURNED, DESTROYED, DONATED) in it to do the same thing as locking that row? Again thank you for your help.

  7. #7
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Lock row based on one cells value

    You should know, my code only reacts to "Returned", not the capitalized version.

    Update this line:

    Please Login or Register  to view this content.
    Last edited by maniacb; 10-03-2020 at 10:01 PM.

+ 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. How to Lock Cells based on other cell value ?
    By avijit74 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-29-2019, 02:00 AM
  2. Lock cells based on a date
    By antonywijesinghe in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-13-2018, 03:05 AM
  3. lock cells based on colourindex
    By ngan202 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-27-2017, 01:04 PM
  4. Lock Cells based on criteria
    By amandeep08 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2016, 11:58 AM
  5. Lock cells within a row based on cell value
    By PY_ in forum Excel General
    Replies: 2
    Last Post: 11-14-2010, 12:40 AM
  6. Lock row of cells based on value in one column
    By freud1 in forum Excel General
    Replies: 1
    Last Post: 06-07-2010, 11:46 PM
  7. Lock cells based on value of other cells - code simplification query
    By glenin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-07-2009, 03:11 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