每条警告信息后如何走出去?

时间:2013-02-11 13:16:34

标签: excel vba

ActiveSheet.Unprotect
Cells.CheckSpelling SpellLang:=2057
If Range("F4").Value = 1 Then                                                  
    MsgBox "MARKED UP BUDGET does not equal TOTAL! Please amend as required"
    Application.Run "LATESTMEDIAPLANVERSION.xlsm!final"

我目前有两段产生警告框的代码。但是目前这些弹出但不会从宏中弹出你.I。我只是想确保这一行:

Application.Run......
只有在未提示警告框时才会到达

。什么是正确的代码?

1 个答案:

答案 0 :(得分:0)

将您的代码更改为:

ActiveSheet.Unprotect

Cells.CheckSpelling SpellLang:=2057


If Range("F4").Value = 1 Then                                                  

     MsgBox "MARKED UP BUDGET does not equal TOTAL! Please amend as required"
     Exit Sub

else

    Application.Run "LATESTMEDIAPLANVERSION.xlsm!final"

end if