Hi,

I've sourced a code online for locking cells based on value but it seems to lock the cells above that aren't equal to the value.

I combined it with my code to essentially add the date to column L and then lock the cell in column K to prevent someone from editing it and the sequence running again and overriding the value in column L.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Dim blnUnlockedAllCells As Boolean

    If Target.Column = 11 And Target.Value <> "V" Then
        Exit Sub

    ElseIf Target.Column = 11 And Target.Value = "V" Then
        ThisRow = Target.Row
        If Target.Value <> "" Then
            Range("L" & ThisRow).Value = Now
            End If
    End If
    
    Const RangeToLock As String = "K8:K1000"
    
    If Target.Cells.Count > 1 Or Target.Value <> "V" Then Exit Sub
    
    If Not blnUnlockedAllCells Then
        Me.Cells.Locked = False
        On Error Resume Next
        Me.Range(CStr(RangeToLock)).SpecialCells(2).Locked = True
        On Error GoTo 0
        blnUnlockedAllCells = True
        Me.Protect Password:="PWD", userinterfaceonly:=True
    End If
    
    If Not Application.Intersect(Target, Me.Range(CStr(RangeToLock))) Is Nothing Then
        If Len(Target) Then Target.Locked = True
    End If

End Sub
Any help understanding why it is locking cells above it if they are filled with any value will be much appreciated. Equally, any help simplifying the code would also be appreciated.

ty