我使用的是 excel 2013。当出现运行时错误时,我没有得到任何调试选项。如何在运行时错误期间获得调试选项?
编辑-我意识到我只在以下情况下遇到这个问题。通常我会得到调试选项(除了这种情况)。特别痛苦的是它甚至不告诉我错误在哪一行。
错误的屏幕截图 -
代码如下——
Option Explicit
Option Base 1
Sub doit()
Dim intRowCounter As Long
Dim intColCounter As Long
Dim parentFormula As String
Dim resultantFormulas As String
For intRowCounter = 1 To 100
For intColCounter = 1 To 200
'This is the line giving the error
parentFormula = Right(parentFormula, Len(parentFormula) - 1)
Next intColCounter
Next intRowCounter
End Sub
错误的屏幕截图https://i.stack.imgur.com/fndsc.jpg
![enter image description here](https://i.stack.imgur.com/fwXVf.png)
我遇到这个线程是因为我有一个电子表格,当宏遇到错误时我没有得到调试选项。我发现,如果我创建一个模块并将相同的子项放入模块而不是工作表中,那么当发生错误时我会得到调试选项。
如果我将该函数保留在工作表中,我可以以不同的方式设置选项。如果我将其保留为“在未处理的错误上中断”,我只会收到一条错误消息,如果我将其设置为“在所有错误上中断”或“在类模块中中断”,那么当发生错误时我会得到调试选项。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)