View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default lock/unlock cells

Try this:

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect
If Range("B20").Value < "" Then
Range("B21").Locked = True
Else
Range("B21").Locked = False
End If
If Range("B21").Value < "" Then
Range("B20").Locked = True
Else
Range("B20").Locked = False
End If
ActiveSheet.Protect
End Sub

--
Ian
--
"john tempest" wrote in message
...
say i have 2 cells B20 and B21. when i enter a number in B20 i want B21 to
lock, i also want this to work via versa so if i enter a number in B21 i
want
B20 to lock. this is so a number cannot be put in both cells
is this possible
thankyou john tempest