VBA & Macro Problems

Add a Blank Line to an Excel VBA MsgBox

Emma BrownEmma Brown Nov 14, 2026 868 views

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.
Before you start

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.

Solution 1Recommended

Use Two vbCrLf Constants in the MsgBox Text

Use two consecutive line breaks to leave one empty line between message sections.

1
Open the VBA code

In Excel, open Developer > Visual Basic, then select the module containing your MsgBox statement.

2
Add two line breaks

Join the two text sections with vbCrLf twice, for example: MsgBox "self-explanatory" & vbCrLf & vbCrLf & "If not any of these, enter YES in".

3
Run the macro

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.

Use Two vbCrLf Constants in the MsgBox Text
Why two line breaks?: The first vbCrLf ends the first line; the second creates the empty line before the next text section.
Free Microsoft Office alternative

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.

Open and edit Excel-compatible XLSX spreadsheetsWork with spreadsheet data in a familiar interfaceUse a free, lightweight alternative for everyday office tasksReview macro requirements before moving VBA-dependent workbooks
microsoft office alternative - wps office

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.