无法在中断模式下执行宏

无法在中断模式下执行宏

本文介绍了无法在中断模式下执行宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  Sub add()$ b我正在尝试编写一个简单的宏来为单元格的当前值添加1: $ b MsgBox Selection.Value 
Selection.Value = Selection.Value + 1
End Sub

当我点击(数字)单元格并尝试运行宏时,我收到以下错误消息:

 不能执行休息模式

我缺少什么?

解决方案

您已经执行了一个宏,并以某种方式停止执行(例如,由于未处理的错误或因为您按下 - ,您可以逐步浏览代码。 继续执行。


I am trying to write a simple macro to add 1 to the cell's current value:

Sub add()
    MsgBox Selection.Value
    Selection.Value = Selection.Value + 1
End Sub

I receive the following error message when I click a (numeric) cell and try to run the macro:

Cannot Execute in Break Mode

What am I missing?

解决方案

You are already executing a macro and somehow stopped its execution (e.g. due to an unhandled error or because you pressed - during the execution). In this state, you cannot execute another macro.

In the Visual Basic Editor, you need to press the Stop button:

Then you can run the macro.

If you want to understand where the current execution is stopped, right click the code and select Show Next Statement. If you then press you can step through the code. continues the execution.

这篇关于无法在中断模式下执行宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 00:08