Keep carriage returns in html code when concatenate

mexmanz

Board Regular
Joined
Sep 19, 2005
Messages
72
Hi,

I have been looking everywhere for a solution for this?

I have some html code for simple webpage layout and have split this into multiple cells on a sheet where some cells will always be identical (the main code structure) and other cells will have different text (e.g. name, description, etc)

In each cell the code is laid out the same as in a web editor with carriage returns or separate lines e.g.

</head>
<body bgcolor="#E6E6E6" text="black" link="blue" vlink="purple" alink="red">
<p align="center"><span style="font-size:1pt;"><br>
</span>
</p>
<table width="900" bgcolor="white" height="375" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="900" height="1075" style="margin:2px; padding:7px; border-width:4px; border-style:double;">
<table border="2" width="890" bgcolor="white" align="center" cellspacing="0" bordercolordark="#E6E6E6" bordercolorlight="white" bordercolor="white" height="1086">
<tr>
<td width="145">
<p align="center"> </p>
</td>

When I concatenate all the cells to produce the full page code, then copy back to web editor, it removes the separate lines and appears thus:

</head><body bgcolor="#E6E6E6" text="black" link="blue" vlink="purple" alink="red"><p align="center"><span style="font-size:1pt;"><br></span></p><table width="900" bgcolor="white" height="375" cellpadding="0" cellspacing="0" align="center"> <tr> <td width="900" height="1075" style="margin:2px; padding:7px; border-width:4px; border-style:double;"> <table border="2" width="890" bgcolor="white" align="center" cellspacing="0" bordercolordark="#EE6E6" bordercolorlight="white" bordercolor="white" height="1086"> <tr> <td width="145"> <p align="center"> </p> </td>



How can I concatenate all the cells of code and keep the layout with all the carriage returns/lines?

This is specifically for the code itself, I do not want to add <br> or char(10)(13) to force it, just want to keep the original layout and code?

many thanks
Andrew
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

andiemac

Board Regular
Joined
Oct 8, 2009
Messages
228
Try using "Alt+Enter". You have to be in edit mode in the cell before pressing Alt. So you would type into the cell "</head>" and before leaving the cell press Alt+Enter.

Depending on how the data is entered in your cells you can either add this to the end of the contents of each cell that needs it, or you could just make one cell with that carriage return in it and concatenate it in your string where you need it.
 

Watch MrExcel Video

Forum statistics

Threads
1,095,392
Messages
5,444,204
Members
405,273
Latest member
cswshaun

This Week's Hot Topics

Top