Paste text into single cell

geobruin

New Member
Joined
Apr 20, 2009
Messages
7
Hi! I have a couple scripts that I would like to run on chunks of text in a single cell (A1). The problem I have is that often the text I copy has paragraph breaks so Excel likes to throw each line of text in a new row. Here is some example text:

Buddy you're a boy make a big noise
Playing in the street gonna be a big man some day
You got mud on yo' face, you big disgrace
Kicking your can all over the place

Singing
We will we will rock you
We will we will rock you


When I highlight cell A1 and paste the text, the first line appears in A1 but the second line starting with "Playing in the street" appears in A2. I would like the text to appear as a continuous string as below:


Buddy you're a boy make a big noise Playing in the street gonna be a big man some day You got mud on yo' face, you big disgrace Kicking your can all over the place Singing We will we will rock you We will we will rock you

I guess ideally, every paragraph break would just become a space.

Thanks in advance,

Cheers!


 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi

To paste the text into the cell:

- Select the cell
- click on the formula bar
- paste

All the text will be pasted in the same cell.

If you want you can then replace the newlines with spaces.
 
Upvote 0
Wow. That was stupid simple. Thank you.

As for replacing "newlines" with spaces, how do I identify a "newline" and a space in the find and replace tool?

Thanks again!
 
Upvote 0
A newline is usually, depending where you imported the text from, either just a linefeed (character ascii 10) or a carriage return followed by a linefeed (characters ascii 13, 10).

Assuming you pasted the text in A1, use in B1

for the first case:

=SUBSTITUTE(A1,CHAR(10)," ")

for the second case:

=SUBSTITUTE(A1,CHAR(13)&CHAR(10)," ")
 
Upvote 0
[h=2]How to preserve paragraph breaks in pasted text? [/h]
There's an easy way to preserve the paragraph breaks. If you only select the cell and then paste, it will go into multiple cells like you are experiencing. However, if you double click in the cell so your cursor is active, and then paste, it will all go in the same cell.

Wes​
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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