Parsing a cell that has mulitiple carraige returns (ALT-ENTER) into multiple rows

cmschu

New Member
Joined
Apr 25, 2012
Messages
4
I'm trying to figure out how I can automate parsing out cells that have multiple line items entered into it -- out into a row per item. Example content. The following is all in one cell and I have many of these. How do I find the hard return in order to break them out into different rows.

ActiveCell = B2
* Interoperability: Address operating in a high matrix environment <ALT-ENTER>
* Finance: Underlying requirements for SOW <ALT-ENTER>
* Change Mgmt.: Navigate constant changes to work more effectively

I want to insert blank rows below this cell and break out each line out to a single row / cell for each underneath it

B3 = * Interoperability: Address operating in a high matrix environment
B4 = * Finance: Underlying requirements for SOW
B5 = * Change Mgmt.: Navigate constant changes to work more effectively
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,618
Office Version
  1. 2007
Platform
  1. Windows
Try this macro

VBA Code:
Sub Parsing_cell()
  Dim i As Long, j As Long
  Dim c As Variant
  
  Application.ScreenUpdating = False
  For i = Range("B" & Rows.Count).End(3).Row To 2 Step -1
    c = Split(Range("B" & i), Chr(10))
    For j = UBound(c) To 0 Step -1
      If j = 0 Then
        Range("B" & i).Value = c(j)
      Else
        Range("B" & i + 1).EntireRow.Insert
        Range("B" & i + 1).Value = c(j)
      End If
    Next j
  Next i
End Sub
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,618
Office Version
  1. 2007
Platform
  1. Windows
I'm glad to help you. Thanks for the feedback.
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
48,373
Office Version
  1. 365
Platform
  1. Windows
I'm guessing that you have other columns that need to be kept aligned but if it was just a single column then you could also do this.

VBA Code:
Sub SplitToRows()
  Dim a As Variant
  
  a = Split(Join(Application.Transpose(Range("B2", Range("B" & Rows.Count).End(xlUp))), Chr(10)), Chr(10))
  Range("B2").Resize(UBound(a) + 1).Value = Application.Transpose(a)
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,127,107
Messages
5,622,782
Members
415,927
Latest member
vedasinternational

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
Top