Locking A cell determined by data
Sorry I figured it out.
I don't know how to count.
Also added
else target.locked = false
Thanks for your help.
"Learning VBA" wrote in message
...
I sent this yesterday but never showed up in the newsgroup.
put this in the code and No Matter what is in the target it locks the
cell.
I just put in 1 cell "Add Name 1: " and it locked
All other cells in the range stayed unlocked.
If Not isect Is Nothing Then
If Left(Target.Value, 9) < "Add Name" Then
"Per Jessen" wrote in message
...
Hi
Something like this (this is an event code and has to be inserted in the
code sheet for the desired sheet):
Private Sub Worksheet_Change(ByVal Target As Range)
Set isect = Intersect(Target, Range("J10:J25"))
If Not isect Is Nothing Then
If Target.Value < "Add Name" Then
ActiveSheet.Unprotect Password:="JustMe"
Target.Locked = True
ActiveSheet.Protect Password:="JustMe"
End If
End If
End Sub
Regards,
Per
"Learning VBA" skrev i meddelelsen
...
Is there a way to lock a cell if it does not contain data?
Example
I have a range of cells:
J10 though J25
The cells currently have "Add Name" these cells are unlocked for input.
If they are changed and no longer have "Add Name" I would like to lock
any cell that has changed.
|