View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
bethg7 bethg7 is offline
external usenet poster
 
Posts: 8
Default locking a cell after input

I just tried it and it worked!! Thanks so much. This will be a real big
help to me to keep me from changing what I have already entered.

"Rowan" wrote:

Right click the sheet tab, select View Code and paste this procedure into the
sheet code module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value 0 Then
Me.Unprotect
Target.Locked = True
Me.Protect
End If
End Sub

This will work if the sheet protection was set without a password. Otherwise
try:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value 0 Then
Me.Unprotect Password:="mypassword"
Target.Locked = True
Me.Protect Password:="mypassword"
End If
End Sub

Hope this helps
Rowan

"bethg7" wrote:

I have a sheet that is protected except for one column that I need to put
sales receipts into. Is there a way for me to maybe do a conditional
formatting and have the cell locked after it's contents are 0.00? I am
using WinXP and Excel 2002