ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Lock the cell once enter the data (https://www.excelbanter.com/excel-worksheet-functions/104435-lock-cell-once-enter-data.html)

Dinesh

Lock the cell once enter the data
 
Hi,

I sthere anyway can you lock and unlock the cell once you enter the data?

For example : If enter "Yes" to an greement on Cell C50. I want to lock the
cell, so nobody can change the answer except myself. I am sure we can use
helper cell to create somekind of formula which I am not sure what it is?

Thanks to advise

Dinesh

Otto Moehrbach

Lock the cell once enter the data
 
All cells are set to "Locked" by default. But the Locked/Unlocked setting
does not mean anything until the sheet is protected. With the sheet
protected, the locked cells cannot be changed.
In your case, I would unlock all the cells on the sheet, then when any
entry is made to any cell in some specific group of cells, I would Unprotect
the sheet, set that one cell to Locked, and Protect the sheet again. You
need to do this with VBA to prevent the user from changing any occupied
cell. The following macro is an example:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect
End Sub
The macro will execute whenever ANY cell is changed. I'm sure that you want
to restrict this action to a specific group or range of cells. Post back if
you need more. HTH Otto
"Dinesh" wrote in message
...
Hi,

I sthere anyway can you lock and unlock the cell once you enter the data?

For example : If enter "Yes" to an greement on Cell C50. I want to lock
the
cell, so nobody can change the answer except myself. I am sure we can use
helper cell to create somekind of formula which I am not sure what it is?

Thanks to advise

Dinesh





All times are GMT +1. The time now is 04:06 PM.

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