Guys, I have a shared workbook which I have the code below to prevent users from deleting data unless they have the password. That works great. But I noticed users instead are just over-writing the data with new data. Is there a way I can lock the cells once they tab away thus requiring password to make changes?
Code:
[COLOR=#333333]Private Sub Worksheet_Change(ByVal Target As Range)[/COLOR] Dim sPassCheck As String
Dim rng As Range
Dim sTemp As String
Dim sPassword As String
sPassword = "Password"
sTemp = "Only members of the Management Team is authorized to delete an entry."
'Use to set a single cell if more than one cell is
'in the target range
If Target.Count > 1 Then
Set rng = Target.Cells(1, 1)
Else
Set rng = Target
End If
If rng.Value = "" Then
sPassCheck = InputBox(sTemp, "Delete check!")
Application.EnableEvents = False
If sPassCheck <> sPassword Then Application.Undo
End If
Application.EnableEvents = True [COLOR=#333333]End Sub[/COLOR]