VBA: copy a group of multi-paragraph text in each row separated by a number from a txt file

jaimond

Board Regular
Joined
Jun 23, 2017
Messages
56
Copy the group of multi-paragraph text in each row separated by a number (like 1., 4., 2. )in a txt file.
Numbers may appear random.

txt file data looks like
1. Text

Text1

Text1

4. Text

Text1

Text1

Text11
Text12

Text14

Text15

2. Text

Text1

Text1


txt file data looks like
Output Sheet
Cell A2/1. Text |Cell B2/Text1 |Cell C2/Text1
Cell A3/1. Text |Cell B3/Text1 |Cell C3/Text1 | Cell D3/Text11 Text12 | Cell E4/Text14 | Cell F4/Text15
Cell A2/1. Text |Cell B2/Text1 |Cell C3/Text1
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Input & Output Corrected:

Apologies for my mistake. It happened as I tried to post it quickly.


I have a text file containing multi-paragraph text
Now I have to Copy the multi-paragraph text separated by a number (like 1., 4., 2. )in a txt file in each row as the given output example.
Numbers may appear random or repeated in the text file.

The Text in the text.txt file looks like the below:
1. Text

Text11111
11111

Text1
11111
11111




4. Text

Text
11111
1122

Text
11111
1122
4444

Where do you live in USA
New York

Text14

Text15

2. Text

Where do you live in USA

Text1Where do you live in USA. Text1Where do you live in USA.


Now I am looking for output in an excel sheet like this:

paragraph1paragraph2paragraph3paragraph4paragraph5paragraph6
1. TextText11111 11111Text1 11111 11111
4. TextText 11111 1122Text 11111 1122 4444Where do you live in USA New YorkText14Text15
2. TextWhere do you live in USAText1Where do you live in USA. Text1Where do you live in USA.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

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