How to display newline in Excel?
January 12, 2008
The commonly used to display newline in Visual Basic is using VbCrLF. But the problem is you will see a small rectangle at the end of the line.

Visual Basic:
-
Dim strFirstLine As String
-
Dim strSecondLine As String
-
-
strFirstLine = "This is the first line"
-
strSecondLine = "This is second line"
-
-
Worksheets("Sheet1").Range("b4").Value = _
-
strFirstLine & vbCrLf & strSecondLine
To solve this problem, you will need to change the code from VbCrLF to VbLf.
Visual Basic:
-
Dim strFirstLine As String
-
Dim strSecondLine As String
-
-
strFirstLine = "This is the first line"
-
strSecondLine = "This is second line"
-
-
Worksheets("Sheet1").Range("b4").Value = _
-
strFirstLine & vbLf & strSecondLine







Recent Comments