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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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
1Sample Text
123
abc

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

<tbody>
</tbody>
Sheet637

Worksheet Formulas
CellFormula
B1=SUBSTITUTE(A1,CHAR(10),"\par"&CHAR(10))&"\par"

<tbody>
</tbody>

<tbody>
</tbody>


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,214,605
Messages
6,120,476
Members
448,967
Latest member
visheshkotha

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