Cut and paste paragraphs in new line

Mosamba

New Member
Joined
Jun 3, 2014
Messages
12
Guys I have a spreadsheet which is full of lines, each one populated by many paragraphs separated by full stops.
I need to cut each of these paragraphs and paste them into individual lines.

Appreciate very much your help.

Thank you
 
Description is pretty vague in terms of layout and just what the data is like. Also, you refer to paragraphs separated by full stops where normally it is sentences that are separated by full stops.

Anyway, see if this might get you started. If not, a small selection of sample data and expected results might help.

Starting with the data in column A in the screen shot below, the code produces the results shown in the other columns. I have assumed that each sentence is separated by a full stop and a space.

Rich (BB code):
Sub SplitSentences()
  With Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row)
    .Value = .Offset(, -1).Value
    .Replace What:=". ", Replacement:=".#", LookAt:=xlPart
    .TextToColumns Destination:=.Cells(1), DataType:=xlDelimited, Tab:=False, _
      Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:="#"
  End With
End Sub

Excel Workbook
ABCDEF
1
2This cell is full. Of a number. Of short sentences.This cell is full.Of a number.Of short sentences.
3This one. Has less.This one.Has less.
4This has only one sentence.This has only one sentence.
5Again. This cell is full. Of a number. Of short sentences.Again.This cell is full.Of a number.Of short sentences.
Split Sentences
 
Upvote 0
Description is pretty vague in terms of layout and just what the data is like. Also, you refer to paragraphs separated by full stops where normally it is sentences that are separated by full stops.

Anyway, see if this might get you started. If not, a small selection of sample data and expected results might help.

Starting with the data in column A in the screen shot below, the code produces the results shown in the other columns. I have assumed that each sentence is separated by a full stop and a space.

Rich (BB code):
Sub SplitSentences()
  With Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row)
    .Value = .Offset(, -1).Value
    .Replace What:=". ", Replacement:=".#", LookAt:=xlPart
    .TextToColumns Destination:=.Cells(1), DataType:=xlDelimited, Tab:=False, _
      Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar:="#"
  End With
End Sub

Split Sentences

*ABCDEF
******
This cell is full. Of a number. Of short sentences.This cell is full.Of a number.Of short sentences.**
This one. Has less.This one.Has less.***
This *has only one sentence.This *has only one sentence.****
Again. This cell is full. Of a number. Of short sentences.Again.This cell is full.Of a number.Of short sentences.*

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:357px;"><col style="width:193px;"><col style="width:117px;"><col style="width:136px;"><col style="width:139px;"><col style="width:40px;"></colgroup><tbody>
[TD="bgcolor: #cacaca, align: center"]1[/TD]

[TD="bgcolor: #cacaca, align: center"]2[/TD]

[TD="bgcolor: #cacaca, align: center"]3[/TD]

[TD="bgcolor: #cacaca, align: center"]4[/TD]

[TD="bgcolor: #cacaca, align: center"]5[/TD]

</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
Hello Peter,
You got it right regarding sentences and not paragraphs.
It worked perfectly.
Thanks very much again.
All the best!
 
Upvote 0

Forum statistics

Threads
1,226,795
Messages
6,193,046
Members
453,772
Latest member
aastupin

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