Protect cell contents after data entry

P

Paul B

Carlossaltz, here is one way, unlock all cells in the range first, put in
worksheet code


Private Sub Worksheet_Change(ByVal Target As Range)
'unlock all cells in the range first
Dim MyRange As Range
Const Password = "123" '**Change password here**
Set MyRange = Intersect(Range("A1:B10,C4"), Target) '**change range
here**
If Not MyRange Is Nothing Then
Unprotect Password:=Password
MyRange.Locked = True
Protect Password:=Password
End If
End Sub


To put in this macro right click on the worksheet tab and view code, in the
window that opens paste this code, press Alt and Q to close this window and
go back to your workbook. If you are using excel 2000 or newer you may have
to change the macro security settings to get the macro to run. To change the
security settings go to tools, macro, security, security level and set it to
medium

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"carlossaltz" <[email protected]>
wrote in message
news:[email protected]...
 
Top