I have the following code which I am using to try to update the security of other cells based on values entered. I don't want this to run every time the user moves from one editable field to another elsewhere in the worksheet.
I think I need to use "Intersect" but honestly, I don't know exactly how.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim wkst As Worksheet
Dim aCell As Range
Dim bCell As Range
Dim cCell As Range
Set wkst = Worksheets("Sheet1")
Set aCell = wkst.Range("J3")
Set bCell = wkst.Range("S3")
Set cCell = wkst.Range("S5")
ActiveSheet.Unprotect Password:="pw1"
If aCell.Value = "LP" Then
bCell.Locked = False
Else
bCell.Locked = True
End If
If bCell.Value = "No" Then
cCell.Locked = False
Else
cCell.Locked = True
End If
ActiveSheet.Protect Password:="pw1"
End Sub
Bookmarks