无法运行Visual Basic编辑器因为录制宏时语法错误 [英] Cannot Run Visual Basic Editor Because of a Syntax error whilst recording macro

查看:1230
本文介绍了无法运行Visual Basic编辑器因为录制宏时语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点惊讶,因为我试图在Excel中记录一个宏,但是我不断得到这个错误:

 无法运行Visual Basic编辑器由于语法错误

最令人惊讶的部分是我没有试图运行任何宏,只是试图记录它。



我第一次注意到这一点,我试图记录一些像

  vlookup(Today(),Sheet2!A1:B2,2)

最初我假设是我键入的公式中出现错误,但是我注意到工作表中显示了正确的值。



现在我有一个模块,看起来像这样,每次我尝试记录错误弹出的东西。

  Option Explicit 
Sub Macro34()
ActiveCell.FormulaR1C1 == TODAY()
End Sub
Sub Macro35()
ActiveCell.FormulaR1C1 == 5
End Sub

其他模块中的一些其他宏代码,但这不应该在当前运行(我也没有看到任何错误)。






我搜索了此错误,但每个发现的结果是有人试图运行一个宏。真的很讨厌我,所以我希望有人能告诉我如何摆脱这个错误。

解决方案

如果我记得正确,在同一Excel文件重复工作后,会出现此问题。
每次创建一个新的模块来记录宏,而在第九个Excel之后,Excel不知道该怎么做。



更改模块的名称,或删除一些解决大多数录音功能的问题。


I am a bit suprised as I am trying to record a macro in Excel, but I keep getting this error:

Cannot Run Visual Basic Editor Because of a Syntax error

The most surprising part is that I am not trying to run any macro yet, just trying to record it.

The first time I noticed this I tried to record something like

vlookup(Today(),Sheet2!A1:B2,2)

Initially I assumed it was an error in the formula I typed, but then I noticed that the correct value was displayed in the sheet.

Now I have a module that looks like this, and each time I try to record something the error pops up.

Option Explicit
Sub Macro34()
    ActiveCell.FormulaR1C1 = "=TODAY()"
End Sub
Sub Macro35()
    ActiveCell.FormulaR1C1 = "=5"
End Sub

I have written some other macro code in other modules, but that is not supposed to run at the moment (and I didn't see any errors in it as well).


I have searched for this error but each found result is about someone trying to run a macro. It is really annoying me so I hope someone can tell me how to get rid of this error.

解决方案

If I recall correctly, this problem occurs after working on the same Excel file repeatedly. Each time a new module is created to record macro's, and after the ninth one Excel doesn't know what to do.

Changing the name of the modules, or removing some solved the problem for most recording functions.

这篇关于无法运行Visual Basic编辑器因为录制宏时语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆