VBA – Newline Character

In VBA, there is 3 types of Newline characters.

  • vbCr – Carriage Return CR
  • vbLf – Line Feed LF
  • vbCrLf – Carriage Return CR + Line Feed LF

Different Newline characters are for different OSs.
Linux and Mac OS X use LF
Windows uses CR + LF
Mac OS and Apply II family use CR.

You can append a Newline character by simple concatenation.

Private Sub CommandButton1_Click()
    Range("A1") = "1st" + vbCrLf + "2nd"
End Sub

 

See what u get!

 

Done =)

Reference:

Advertisements

4 thoughts on “VBA – Newline Character”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.