Public sourceVal
Private Sub Worksheet_Change(ByVal Target As Range)
'判断是否等于历史
If sourceVal <> Target.Text Then
    If Target.Column = 1 Then
       Range("B" + CStr(Target.Row)).ClearContents
       Range("C" + CStr(Target.Row)).ClearContents
    ElseIf Target.Column = 2 Then
       Range("C" + CStr(Target.Row)).ClearContents
    End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    sourceVal = Target.Text
End Sub

  

posted on 2021-02-06 16:08  不知勿言  阅读(131)  评论(0编辑  收藏  举报