View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default 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