Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Locking cells

Is it possible to lock values onto cells right after they 've been entered?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking everything except cells B4:B8 H New Users to Excel 2 July 6th 09 05:57 PM
Locking Cells Hardip Excel Discussion (Misc queries) 3 July 2nd 09 09:05 PM
Locking Cells SJT Excel Discussion (Misc queries) 2 October 29th 06 10:09 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking cells Patrick Simonds Excel Programming 1 December 4th 05 04:22 AM


All times are GMT +1. The time now is 12:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"