ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Lock cells and have them be unlocked based on a cell being (https://www.excelbanter.com/excel-programming/415873-how-lock-cells-have-them-unlocked-based-cell-being.html)

hak0828

How to Lock cells and have them be unlocked based on a cell being
 
To anybody kind enough to take the time to read my post,

I am working on a very simple and basic excel workbook in which I have
many work sheets for different clients with a questionnaire that each
client must complete


One of the questions requires either it be left blank or marked with
an "x".


The question is located in column S and applies to all account of the
clients. If an "x' is placed, then I would like the three following
columns to be unlocked (column T, U, V) so that they can be answered.

Therefore if row 12 has S12 marked with an "x",then T12:V12 will be
unlocked. However if S13 is left blank then S13:V13 are left locked and so
on.....


Is there anybody who can help me.


Thank you so much for your time,


Hakan

Please email me for any suggestions.

All the best



Ron de Bruin

How to Lock cells and have them be unlocked based on a cell being
 
hi hak0828

You can use the change event in the sheet module
http://www.rondebruin.nl/code.htm

If you change a cell in S and it is a "x" it will unprotect the sheet
unlock the three cells and protect the sheet.
If it is not a "x" it lock the cells

I not use a password in this example

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 19 Then '= column S

ActiveSheet.Unprotect
If LCase(Target.Value) = "x" Then
Cells(Target.Row, "T").Resize(, 3).Locked = False
Else
Cells(Target.Row, "T").Resize(, 3).Locked = True
End If
ActiveSheet.Protect

End If
End Sub




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"hak0828" wrote in message ...
To anybody kind enough to take the time to read my post,

I am working on a very simple and basic excel workbook in which I have
many work sheets for different clients with a questionnaire that each
client must complete


One of the questions requires either it be left blank or marked with
an "x".


The question is located in column S and applies to all account of the
clients. If an "x' is placed, then I would like the three following
columns to be unlocked (column T, U, V) so that they can be answered.

Therefore if row 12 has S12 marked with an "x",then T12:V12 will be
unlocked. However if S13 is left blank then S13:V13 are left locked and so
on.....


Is there anybody who can help me.


Thank you so much for your time,


Hakan

Please email me for any suggestions.

All the best




All times are GMT +1. The time now is 07:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com