# Really stupid XL question:  Including carriage returns in a paste to one cell

**URL:** <https://boards.straightdope.com/t/really-stupid-xl-question-including-carriage-returns-in-a-paste-to-one-cell/229134>\
**Category:** In My Humble Opinion\
**Created:** [February 14, 2004, 12:36am UTC](https://boards.straightdope.com/t/really-stupid-xl-question-including-carriage-returns-in-a-paste-to-one-cell/229134 "2004-02-14T00:36:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spectre\_of\_Pithecanthropus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/spectre_of_pithecanthropus/32/12343_2.png) [@Spectre\_of\_Pithecanthropus](https://boards.straightdope.com/u/Spectre_of_Pithecanthropus)\
**Post date:** [February 14, 2004, 12:36am UTC](https://boards.straightdope.com/t/really-stupid-xl-question-including-carriage-returns-in-a-paste-to-one-cell/229134/1 "2004-02-14T00:36:11Z")

</div>

In Microsoft Excel, how can I paste a block of text into a single cell? The text in question is a SQL statement and I’d like to preserve the formatting and paste it into one cell. But Excel splits it into multiple cells wherever there was a carriage return.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![GorillaGirl](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@GorillaGirl](https://boards.straightdope.com/u/GorillaGirl)\
**Post date:** [February 14, 2004, 7:30am UTC](https://boards.straightdope.com/t/really-stupid-xl-question-including-carriage-returns-in-a-paste-to-one-cell/229134/2 "2004-02-14T07:30:05Z")

</div>

Double-click in the cell, or click once in the formula bar at the top, then paste your copied text.

GorillaGirl

---

<div class="post-metadata">

**Author:** ![Siege](https://avatars.discourse-cdn.com/v4/letter/s/dbc845/32.png) [@Siege](https://boards.straightdope.com/u/Siege)\
**Post date:** [February 14, 2004, 11:32am UTC](https://boards.straightdope.com/t/really-stupid-xl-question-including-carriage-returns-in-a-paste-to-one-cell/229134/3 "2004-02-14T11:32:36Z")

</div>

Just a couple of other tips. If I’m starting at too low a level for you, please accept my apologies. This has been part of my job for the last decade or so and the last several jobs I’ve had, and I’ve learned to start from the basics.

[ul][li]First, make sure that the cell you’re putting the text in is formatted to wrap text. To do this, go to the **Format** menu, then click on **Cells**. Check **Wrap** Text on the **Alignment** tab. Click on **OK** [/li]  
[li]Copy the text you want to put into the cell. As **GorillaGirl** said, double click in the cell or click in Formula Bar which sits at the top of the screen.[/li]  
[li]Paste your text.[/li]  
[li]If you want force a line to break where you want it to, rather than letting Excel decide, while you’re editing the contents of the cell, press **Alt** + **Enter**. [/ul][/li]  
Hope this helps,  
CJ

---

<div class="post-metadata">

**Author:** ![GorillaGirl](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@GorillaGirl](https://boards.straightdope.com/u/GorillaGirl)\
**Post date:** [February 14, 2004, 6:27pm UTC](https://boards.straightdope.com/t/really-stupid-xl-question-including-carriage-returns-in-a-paste-to-one-cell/229134/4 "2004-02-14T18:27:30Z")

</div>

Good advice, **Siege**. I’d forgotten about **Alt + Enter** for a line break. However, setting the wrap text property is unnecessary. The carriage returns in the original text will force Excel to wrap it as part of the paste operation.

I started playing around with this, and one thing I found is that the maximum row height is 409.5, or 546 pixels, and some of my test code wasn’t displayed. It was all _in_ the cell, it just wasn’t showing up. For a relatively small number of lines, I could drop the font size, but for larger amounts of text, I ended up merging cells. **Spectre of Pithecanthropus** , try this if you have more than 32 lines of text and it looks like your pasted code is cut off.

Select the cell with text and the one below it, and follow **Siege’s** directions for wrapping, but check **Merge cells** as well. Make sure both boxes are checked, not empty or grayed out. Then re-size the row height of your merged cells. If your text is still cut off, select your merged cells and the one below, and merge cells & wrap text again. Continue doing this until all of your text displays properly.

Good luck. Sometimes getting Microsoft apps to do what you want is like trying to nail jello to a tree. 🙂

---

<div class="post-metadata">

**Author:** ![Spectre\_of\_Pithecanthropus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/spectre_of_pithecanthropus/32/12343_2.png) [@Spectre\_of\_Pithecanthropus](https://boards.straightdope.com/u/Spectre_of_Pithecanthropus)\
**Post date:** [February 16, 2004, 11:04pm UTC](https://boards.straightdope.com/t/really-stupid-xl-question-including-carriage-returns-in-a-paste-to-one-cell/229134/5 "2004-02-16T23:04:10Z")

</div>

Many thanks to both of you. Your information was very helpful.
