ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how to preserve paragraph breaks in pasted text? (https://www.excelbanter.com/excel-discussion-misc-queries/42508-how-preserve-paragraph-breaks-pasted-text.html)

Bob

how to preserve paragraph breaks in pasted text?
 
When I paste text copied from a Word document into an Excel cell, Excel
breaks the pasted text into separate cells according to the paragraph breaks
contained in the pasted text. However, I would like to preserve those
paragraph breaks and keep all the pasted text in the same cell.

I realize that when entering text in a cell, I must insert Alt+Return to get
a paragraph break to stay in the cell. But there doesn't seem to be a way to
force pasted text to stay in a single cell when it contains paragraph breaks.

Any advice would be most appreciated.

Martin P

In Word, change the hard returns to dollar signs, using Edit, Replace.
Copy the cells to Excel.
In Excel, run this macro:
Sub dollartobreak()
Cells.Replace What:="$", Replacement:="" & Chr(10) & "", LookAt:=xlPart,
SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
End Sub

"Bob" wrote:

When I paste text copied from a Word document into an Excel cell, Excel
breaks the pasted text into separate cells according to the paragraph breaks
contained in the pasted text. However, I would like to preserve those
paragraph breaks and keep all the pasted text in the same cell.

I realize that when entering text in a cell, I must insert Alt+Return to get
a paragraph break to stay in the cell. But there doesn't seem to be a way to
force pasted text to stay in a single cell when it contains paragraph breaks.

Any advice would be most appreciated.


Dave Peterson

Manually:

If your cells in your word table contain paragraph mark or linebreak characters,
then excel will bring them over as separate cells.

One way around it is to convert those paragraph marks & linebreaks to unique
characters, then copy|paste and then convert them back to linefeeds.

I like this technique (inside a copy of the word file):
Select your table.
Edit|replace|Special (show More if required)
Find what: (paragraph mark under Special button)
replace with: $$$$$ (if $$$$$ doesn't appear in the table)
replace all

Same thing with Manual Line break (from under Special).

Now copy the table into Excel.

Edit|Replace
Replace what: $$$$$
Replace with: ctrl-j
replace all.

Don't forget to close the word document without saving (or hit undo as many
times as necessary).

Bob wrote:

When I paste text copied from a Word document into an Excel cell, Excel
breaks the pasted text into separate cells according to the paragraph breaks
contained in the pasted text. However, I would like to preserve those
paragraph breaks and keep all the pasted text in the same cell.

I realize that when entering text in a cell, I must insert Alt+Return to get
a paragraph break to stay in the cell. But there doesn't seem to be a way to
force pasted text to stay in a single cell when it contains paragraph breaks.

Any advice would be most appreciated.


--

Dave Peterson

bkrcove

how to preserve paragraph breaks in pasted text?
 
A quick way of doing this if you only have a small amount of text to paste is
to copy it from Word and paste it into the Formula Bar in Excel instead of
into the cell. I have tried this and Excel converts even hard paragraph
breaks in Word into soft paragraph breaks in Excel, which is what we want.


abakr

how to preserve paragraph breaks in pasted text?
 
This can also be solved by double-clicking into a cell and pasting (ctrl-v)
your copied text into it, this will work as well.

"Bob" wrote:

When I paste text copied from a Word document into an Excel cell, Excel
breaks the pasted text into separate cells according to the paragraph breaks
contained in the pasted text. However, I would like to preserve those
paragraph breaks and keep all the pasted text in the same cell.

I realize that when entering text in a cell, I must insert Alt+Return to get
a paragraph break to stay in the cell. But there doesn't seem to be a way to
force pasted text to stay in a single cell when it contains paragraph breaks.

Any advice would be most appreciated.



All times are GMT +1. The time now is 07:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com