السلام عليكم ورحمة الله وبركاته
جرب الكود التالى في حدث ورقة العمل
CODE
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.CountLarge > 1 Then Exit Sub
If Target.Row > 8 And Target.Column = 6 Then
If Target.Value <> Empty Then
On Error Resume Next
Target.Locked = True
On Error GoTo 0
Target.Offset(, -2).Select
ActiveSheet.Protect "123"
End If
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.CountLarge > 1 Then Exit Sub
If Target.Row > 8 And Target.Column = 4 Then
If Target.Value = Empty Or Target.Offset(, 1).Value = Empty Or Target.Offset(, 2).Value = Empty Then
ActiveSheet.Unprotect "123"
Else
On Error Resume Next
Target.Locked = True
On Error GoTo 0
ActiveSheet.Protect "123"
End If
ElseIf Target.Row > 8 And Target.Row = 6 Then
If Target.Value <> Empty Then
On Error Resume Next
Target.Locked = True
On Error GoTo 0
Target.Offset(, -2).Select
ActiveSheet.Protect "123"
End If
End If
End Sub