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.
VBA does not word wrap.
The line continuation character "_" is actually two characters.
There must always be a space before the underscore.
This is an underscore character that must be prefixed by a space (" _").
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.

Sub DoSomething(): Dim iNumber1 As Integer: Dim iNumber2 As Integer: _ 
iNumber1 = 5: iNumber2 = 10: Call MsgBox(iNumber1 + iNumber2): End Sub

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