Hello all,
I am trying to use a macro that locks cells V5:V2004 after users have entered data into them.
I have tried the following:
This works fine. However, I prefer a macro that enables me to click again on the filled-up cell where it would prompt me to enter the password so that I can made changes (and thereafter lock the cell again) The code above does not allow that.
Is this possible? Would appreciate the help!
I am trying to use a macro that locks cells V5:V2004 after users have entered data into them.
I have tried the following:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' Code goes in the Worksheet specific module
Dim rng As Range
' Set Target Range, i.e. Range("A1, B2, C3"), or Range("A1:B3")
Set rng = Target.Parent.Range("V5:V2004")
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
' Action if Condition(s) are met (do your thing here)
ActiveSheet.Unprotect "manfield"
Target.Locked = True
ActiveSheet.Protect "PasswordGoesHere"
End Sub
This works fine. However, I prefer a macro that enables me to click again on the filled-up cell where it would prompt me to enter the password so that I can made changes (and thereafter lock the cell again) The code above does not allow that.
Is this possible? Would appreciate the help!