You can't use Target like that, Target refers to the cell(s) selected.
Try this amended code
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Target.Address = "$D$2" Then Exit Sub
Dim cl As Range
Dim rCol As Range
Dim WS As Worksheet
Set WS = Target.Parent
Set rCol = WS.Range(Cells(5, 8), Cells(Rows.Count, 8).End(xlUp))
WS.Unprotect
For Each cl In rCol
If cl.Value = Cells(2, 3).Value And Cells(2, 4).Value = "Locked" Then
Range(Cells(cl.Row, 1), Cells(cl.Row, 8)).Locked = True
Else: Range(Cells(cl.Row, 1), Cells(cl.Row, 7)).Locked = False
End If
Next cl
WS.Protect
End Sub
Bookmarks