My columns have line breaks, but how can I convert these to vbCrLf
when reading with Range("A" & r).Value
?
views:
255answers:
1
+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
2009-09-14 13:48:07
great, but got syntax error??
Tom
2009-09-14 13:50:54
also got syntax error for Replace(mystr, chr(10), vbCrLf)
Tom
2009-09-14 13:53:38
Did you assign the return value? I updated my example to include a variable to assign to.
DR
2009-09-14 13:57:28