HangMan,
In the appropriate worksheet code module:
Const strPW As String = "abc123"
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim strLock As String
If Not Intersect(Target, Me.Range("C12:C15")) Is Nothing And Target.Cells.Count = 1 Then
Application.EnableEvents = False
Me.Unprotect strPW
With Me.Range("C18:C27")
.Locked = False
.Interior.Color = xlNone
End With
Select Case Target.Address(0, 0)
Case "C12": strLock = "C19:C27"
Case "C13": strLock = "C18,C22:C27"
Case "C14": strLock = "C18:C21,C25:C27"
Case "C15": strLock = "C18:C24"
End Select
With Me.Range(strLock)
.Locked = True
.Interior.Color = RGB(255, 0, 0)
End With
Me.Protect strPW
Me.EnableSelection = xlUnlockedCells
Application.EnableEvents = True
End If
End Sub
Bookmarks