If you select Debug the application stops on the error line as the screenshot below shows This behaviour is fine when you are writing VBA code as it shows you the exact line with the error.
If we think an error is likely to occur at some point, it is good practice to write specific code to handle the error if it occurs and deal with it.
For all other errors we use generic code to deal with them.
When an error occurs, VBA stops on the line with the error and displays the error message.
The application requires user intervention with the code before it can continue. In the following code, we have not used any On Error line so VBA will use the On Error Goto 0 behavior by default.
The line will still appear red if there is an error but the dialog will not appear. The syntax is correct on a single line but is incorrect when all the project code is taken into account.