'Cannot Run Visual Basic Editor Because of a Syntax error whilst recording macro
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.
Solution 1:[1]
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.
Solution 2:[2]
You're trying to run macros when the Macro Recorder is on - turn it off
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dennis Jaheruddin |
Solution 2 | mcmillab |