Add a Blank Line to an Excel VBA MsgBox
Question details
The user wants to insert a visibly blank line between two text sections in an Excel VBA message box.
- Product
- Microsoft Excel VBA
- Device & OS
- not provided
- Scenario
- Formatting a MsgBox message so that two sections of text are separated by an empty line.
- Observed behavior
- A single vbCrLf moves the next text section to a new line but does not create an empty line between the sections.
Open the Excel workbook containing the macro and locate the MsgBox statement in the Visual Basic Editor. Make sure macros are enabled if you want to run the code and check the result.
Use Two vbCrLf Constants in the MsgBox Text
Use two consecutive line breaks to leave one empty line between message sections.
In Excel, open Developer > Visual Basic, then select the module containing your MsgBox statement.
Join the two text sections with vbCrLf twice, for example: MsgBox "self-explanatory" & vbCrLf & vbCrLf & "If not any of these, enter YES in".
Place the cursor inside the procedure and select Run > Run Sub/UserForm in the Visual Basic Editor. Check that the message box shows an empty line between the text sections.

Work with Excel Spreadsheets in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface and Excel format support for a smooth move between spreadsheet applications. Check VBA support in your WPS edition before migrating a workbook that relies on macros.

Frequently Asked Questions
Why does one vbCrLf not leave a blank line?
One vbCrLf starts the next line. Use & vbCrLf & vbCrLf & between the two text strings to leave an empty line.
Where do I edit the MsgBox statement?
In Excel, select Developer > Visual Basic and open the module that contains the macro. Edit the text inside its MsgBox statement.
How can I add more than one empty line?
Add another vbCrLf for each additional empty line. For example, three consecutive vbCrLf constants leave two empty lines between text sections.
Will an Excel VBA macro run in WPS Office?
VBA support depends on the WPS edition and its available components. Check the VBA support for your edition and test the workbook before relying on the macro in WPS.




