S
storminspank
I have a cell on one of worksheets that I need to password protect.
I want the user to be prompt to enter a password once they try to
modify the cell.
What is the easiest way to accomplish this? I am told that using a
macro is the best way to achieve it.
I found this code on here:
Private Sub Worksheet_Change(ByVal Target As Range)
'******unlock all cells in the range first*********
Dim MyRange As Range
Const Password = "tcmvsales99" '**Change password here**
Set MyRange = Intersect(Range("B4"), Target) '**change range
here**
If Not MyRange Is Nothing Then
Unprotect Password:=Password
MyRange.Locked = True
Protect Password:=Password
End If
End Sub
which will protect the cell once data is enter.
Any help would be much appreciated.
Thanks,
Justin
I want the user to be prompt to enter a password once they try to
modify the cell.
What is the easiest way to accomplish this? I am told that using a
macro is the best way to achieve it.
I found this code on here:
Private Sub Worksheet_Change(ByVal Target As Range)
'******unlock all cells in the range first*********
Dim MyRange As Range
Const Password = "tcmvsales99" '**Change password here**
Set MyRange = Intersect(Range("B4"), Target) '**change range
here**
If Not MyRange Is Nothing Then
Unprotect Password:=Password
MyRange.Locked = True
Protect Password:=Password
End If
End Sub
which will protect the cell once data is enter.
Any help would be much appreciated.
Thanks,
Justin