Locking cells
Is it possible to lock values onto cells right after they 've been entered?
|
Locking cells
I mean is there something like an event like the loss of focus by the cell or
something like that? Thanks in advance |
Locking cells
Copy the following code into each sheet you want the rule to apply to
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Locked < True Then If ActiveCell < "" Then ActiveSheet.Unprotect ActiveCell.Locked = True ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End If End If End Sub If I understand you correctly this should do the trick "João Costa" wrote in message ... I mean is there something like an event like the loss of focus by the cell or something like that? Thanks in advance |
Locking cells
Understand, that in using the SelectionChange feature, as you bounce around
the worksheet by selecting different areas, the cell(s) you leave will be forced to be locked if they are not entered. Might consider just the Change sub instead. Also if the user inadvertently hits a key and changes locations or enters the wrong data, you have to deal with that as well... "michael fuller" wrote: Copy the following code into each sheet you want the rule to apply to Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Locked < True Then If ActiveCell < "" Then ActiveSheet.Unprotect ActiveCell.Locked = True ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True End If End If End Sub If I understand you correctly this should do the trick "João Costa" wrote in message ... I mean is there something like an event like the loss of focus by the cell or something like that? Thanks in advance |
All times are GMT +1. The time now is 07:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com