Frequently when entering code I will type half of a line, for example the opening part of an if statement, but rather than type the second half I will want to copy and paste, both for convenience and to minimize the chance of a typing error. However if I move the focus away from a half completed statement I get the very annoying "compile error, expected end of statement" pop up which I must acknowledge. This is becoming very tedious when it comes up so often.
Is there any way to tell excel not to show this error message?
To correct this error Check to see if two different statements have inadvertently been put on the same line. Insert a line terminator after the element that completes the statement.
Do the following in your VBA editor window (entitled "Microsoft Visual Basic for Applications"): Click the menu "Tools" and then "Options". In the Options' "Editor" tab, uncheck the "Auto Syntax Check" box. (See screenshot, below.)
I have resolved same error by following these 4 steps : Open Excel file which is having issue, press Alt + F11 go into its Visual Basic Editor. From the Tools menu select References ( Note, if references option is disabled in tools menu try closing and reopening file and enable Macro before proceeding next steps)
Exit the error handler and resume the macro at the line that caused the error. Your macro must automatically correct the error condition or prompt the user to correct it before resuming; otherwise, the error will occur again. Resume the macro at the line following the one that caused the error.
Annoying isn't it? Click Tools
-> Options
-> Editor
Tab and uncheck Auto syntax check
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With