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
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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.
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,585
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top