我需要一些帮助。每当用户键入不在批准日期之内的日期时,我想触发一个消息。批准的日期在W12和W13单元格中。用户在下面的单元格N13上输入日期是我的代码
Sub ErrorValidation_Change(ByVal target As Range)
If target.Address = "$N$13" Then
If target.Value > Range("W12") And target.Value < Range("W13") Then
MsgBox "Date should be around" & Range("w12")
Else
do nothing
End If
End If
End Sub
答案 0 :(得分:0)
以下是更正的工作代码....
Public Sub worksheet_change(ByVal target As Range)
If target.Address = "$N$13" Then
If target.Value > Range("W12") And target.Value < Range("W13") Then
'do nothing
Else
MsgBox "Date should be around" & Range("w12")
End If
End If
End Sub