Find enter stroke and add text

Excel_Blonde

New Member
Joined
Aug 8, 2018
Messages
44
Hi There,

I'm looking for a VBA script (or formula) to find an enter stroke and add text.

E.g

Sample Text
123
abc

Def
GHI

To appear:

Sample Text\par
123\par
abc\par
\par
Def\par
GHI\par

Apologies if this question has previously been asked and answered, I cant find anything on the forums but may be using the wrong words in my searches.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try Ctrl H
Find what > Ctrl J
replace > \par
Make sure that match cell contents is unchecked
Replace all
 
Upvote 0
Assuming that your data starts in A1 put the following formula in B1

=A1&"\par"

Copy the formula down
 
Upvote 0
Hi,

Assuming you mean the sample data shown is all in a Single cell, separated by linefeed, formula option:

AB
Sample Text
123
abc

Def
GHI
Sample Text\par
123\par
abc\par
\par
Def\par
GHI\par

<tbody>
[TD="align: center"]1[/TD]

</tbody>
Sheet637

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH]B1[/TH]
[TD="align: left"]=SUBSTITUTE(A1,CHAR(10),"\par"&CHAR(10))&"\par"[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]


This works perfectly. Thank you all for your suggestions, this has saved me hours if not days of manual input.
 
Last edited:
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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