vba代码,change事件触发则进行锁定对应B列单元格
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Then End
If Target.Value = 1 Then
'//撤销工作表保护
Me.Unprotect 1234
'//锁定目标单元格
Target.Offset(, 1).Locked = True
'//设置工作表保护,密码1234
Me.Protect 1234
Else
Me.Unprotect 1234
End If
End Sub