Hi @NathanA
Quite a long time with no answers...eh?
When you start a new sheet, all the cells are as default "locked", so if you protect the sheet, you cannot write in any cell.
I've added a new line to unlock all the cells in the active range before doing the work
In the code, I used the word "charter" to compare and trigger the action..... you must change this word to the right expression.
Then all the rows that have "charter" in column C will be locked between columns N to W
please try this new code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = True
Dim LR As Long, i As Long
LR = Range("C" & Rows.Count).End(xlUp).Row
Debug.Print LR
If Intersect(Target, Range("C:C")) Is Nothing Then
Exit Sub
End If
Me.Unprotect
Me.UsedRange.Locked = False
For i = 1 To LR
If Range("C" & i).Value = "charter" Then
Range("N" & i & ":W" & i).Locked = True
Else
Range("N" & i & ":W" & i).Locked = False
End If
Next i
Me.Protect
End Sub
Bookmarks