Handling embedded Carraige return/ line feeds

M

Mystery Man

From within a program, I am preparing a CSV file to be loaded into
Excel. Some of the cell string values contain carraige return/line
feeds. When Excel encounters these return/line feeds, it creates a new
row.

Although I can strip these out to prevent the new line being created,
I would prefer not do this as the carraige return/line feeds are
significant.

Is there any other control character that I should convert these to or
is there a better way to handle this (eg using escape characters)?

Thanks
 
B

Bernie Deitrick

Mystery,

Try using just CHR(10) instead onf the CRLF: Excel treats that as a line
break within cells, and shouldn't cause a new line creation when opening the
CSV file.

Of course, since you are in control of both the export and import, you could
use anything you want (like XYZZY) for the export, and then do a find and
replace after the import into Excel.

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top