Splitting String at Blank Empty Row

ESACAWIP

New Member
Joined
Nov 9, 2020
Messages
21
Office Version
  1. 365
Platform
  1. Windows
hi, hope all is good

I am given the following, all in a single cell:

aaa
bbb
ccc

ddd
eee
fff

zzz
eee
eee


can someone help with a macro where if I select the entire column, it would split each cell by the blank row into consecutive columns?
aaa ddd zzz
bbb eee eee
ccc fff eee



Much appreciated!
 
Does this bit Cells(R, "B").Resize(, 3) allows for expanding up to 3 Columns?

Reasons I ask, 1, I don't know
2, OP says he has Strings up to 20 separate substings.
Whoops, you caught me sleeping! :eek: I went with the posted example and completely forgot the OP said that. Thanks for noticing this!!! Here is the corrected code...
VBA Code:
Sub SplitOnDoubleLineFeeds()
  Dim R As Long, Arr As Variant
  Application.ScreenUpdating = False
  For R = 2 To Cells(Rows.Count, "A").End(xlUp).Row
    Arr = Split(Cells(R, "A").Value, vbLf & vbLf)
    Cells(R, "B").Resize(, 1 + UBound(Arr)) = Arr
  Next
  Application.ScreenUpdating = True
End Sub
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,615
Messages
6,120,538
Members
448,970
Latest member
kennimack

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