30 Advanced Excel Tips for 2026

Excel Champs / VBA / How to Add a New Line (Carriage Return) in a String in VBA
By Puneet Gogia (Microsoft MVP)

How to Add a New Line (Carriage Return) in a String in VBA

30+ Advanced Excel Tips for 2026

No spam. Only Excel Stuff. God Promise. 😊

[thrive_leads id=’70897′]

In VBA, there are three different (constants) to add a line break.

  1. vbNewLine
  2. vbCrLf
  3. vbLf

vbNewLine

vbNewLine inserts a new line character that enters a new line. In the below line of code, you have two strings combined by using it.

Range("A1") = "Line1" & vbNewLine & "Line2"

When you run this macro, it returns the string in two lines.

vba-new-line

It returns the characters 13 and 10 (Chr(13) + Chr(10)). You can use a code in the following way as well to get the same result.

Range("A1") = "Line1" & Chr(13) & Chr(10) & "Line2"

But when you use vbNewLine you don’t need to use CHAR function.

vbCrLf

vbCrLf constant stands for Carriage Return and Line feed, which means Cr moves the cursor to the starting of the line, and Lf moves the cursor down to the next line.

When you use vbCrLf within two strings or values, like, you have in the following code, it inserts a new line.

Range("A1") = "Line1" & vbCrLf & "Line2"
carriage-return-and-line-feed

vbLf

vbLf constant stands for line feed character, and when you use it within two strings, it returns a line feed character that adds a new line for the second string.

Range("A1") = "Line1" & vbLf & "Line2"
vblf-that-add-a-new-line

Add a New Line in VBA MsgBox

If you want to add a new line while using the VBA MsgBox you can use any of the above three constants that we have discussed.

MsgBox "Line1" & vbNewLine & "Line2"
MsgBox "Line1" & vbCrLf & "Line2"
MsgBox "Line1" & vbLf & "Line2"

There’s also a constant vbCr that returns a carriage return character that you can use to insert a new line in a message box.

MsgBox "Line1" & vbCr & "Line2"

vbCr won’t work if you want to enter a cell value until you apply wrap text to it.

Puneet Gogia

Written by

Puneet Gogia

Microsoft MVP — Excel · Founder, Excel Champs

Twelve years of teaching Excel, and a decade before that using it as a data analyst. Every tutorial here is written from a file I actually built.

3M+ readers helped
1,000+ tutorials written
Since 2015 teaching Excel