Auto-lock a cell once it's updated
Sheet event code..........to be pasted into the sheet module.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
With Me
.Unprotect Password:="justme" 'password to suit
n = Target.Row
If .Range("A" & n).Value < "" Then
.Range("A" & n).Locked = True 'adjust the "A" if you wanted
'column B locked
End If
End With
End If
enditall:
Application.EnableEvents = True
Me.Protect Password:="justme"
End Sub
When happy with code, hit ToolsVBAProject Properties and protect the code
from view.
Alt + q to return to Excel.
Gord Dibben MS Excel MVP
On Wed, 5 May 2010 11:54:01 -0700, Oscar
wrote:
Hi.
I have a shared workbook that is used by two processors. On column A I have
a drop down that allows the processors to select Yes or No. I would like the
cell that they update to automatically lock by not allowing the processors to
go back and change what they already selected. If they try to change the
info, I would like it to prompt a password request in order to make a change
on that cell. If this is possible please let me know.
Thanks
|