![]() |
How do I conditionally lock cells?
How can I make the ability to edit a cell conditional based on the value of
another cell? For example if cell A1 contains the value "Yes", cell A2 can be edited. However if the value in A1 is "No", cell A2 should be locked. |
How do I conditionally lock cells?
This can be done in code contained in the sheet module.
You probably need the change event. The code should go through the following steps: 1. Verify that the cell (target) being changed is in column A (1) 2. Test cell.value = "Yes" 3. Unprotect worksheet 4. If cell.value = "Yes" then set A2 protection to unlocked 5. elseif cell.value = "No" then set A2 protection to locked 6. else 'code if cell not Yes or No 7 end if 8 Reprotect worksheet Post back if you need actual code... (you can get preliminary code by using the Macro Recorder.) -- steveB Remove "AYN" from email to respond "wahamler" wrote in message ... How can I make the ability to edit a cell conditional based on the value of another cell? For example if cell A1 contains the value "Yes", cell A2 can be edited. However if the value in A1 is "No", cell A2 should be locked. |
All times are GMT +1. The time now is 01:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com