if [a1]="" then
msgbox "a 1 不能为空............."
exit sub
elseif [d1]<>"姓名" then
msgbox "姓名不对,不能执行此程序............."
exit sub
else
要执行的正规程序........
end if
if [a1]="" then
msgbox "a 1 不能为空............."
exit sub
elseif [d1]<>"姓名" then
msgbox "姓名不对,不能执行此程序............."
exit sub
else
要执行的正规程序........
end if
Sub aa()
If [a1] = "" Then
Application.EnableEvents = False
Application.Undo
MsgBox "单元格" & Replace([a1].Address, "$", "") & "不能为空"
Application.EnableEvents = True
Exit Sub
ElseIf [d1] <> "名字" Then
Application.EnableEvents = False
Application.Undo
MsgBox "姓名不对"
Application.EnableEvents = True
Exit Sub
End If
End Sub