Line Continuation Character

Lines of VBA code can often be quite long and difficult to read so you are encouraged to use the line continuation character.
For any lines of code that are quite long you can use the line continuation character to split them into several lines.
The VBA Editor only allows 1023 characters per line.
VBA does not word wrap.
The line continuation character "_" is actually two characters.
There must always be a space before the underscore.
Remember it is possible to have multiple instructions on a single line by using a colon ":" to separate them.
The following two lines is valid syntax but very difficult to read and should be avoided.


Examples

The line continuation character cannot be followed by any other characters (including comments).
You cannot have a line continuation character in the middle of a literal string.


Maximum of 24

You cannot include more than 24 line continuation characters in a single expression.

If you ever run into this limitation, you should use string concatenation instead.

If you ever run into this limitation, you should consider passing in an object.


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext