Tom
Tom

Reputation: 6707

Converting Excel line breaks to vbCrLf?

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

Upvotes: 2

Views: 6239

Answers (1)

Daniel Rikowski
Daniel Rikowski

Reputation: 72514

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.

Upvotes: 3

Related Questions