tags:

views:

255

answers:

1

My columns have line breaks, but how can I convert these to vbCrLf when reading with Range("A" & r).Value?

+2  A: 

In Excel cell line breaks are represended by vbLf, not vbCrLf.

You can replace the line breaks manually:

Dim CellValue As String

CellValue = Replace(Range("A" & r).Value, vbLf, vbCrLf)

That replaces all Excel line breaks with standard Windows line breaks.

DR
great, but got syntax error??
Tom
also got syntax error for Replace(mystr, chr(10), vbCrLf)
Tom
Did you assign the return value? I updated my example to include a variable to assign to.
DR