Devide cell values based on new line

Pontos

Board Regular
Joined
Mar 26, 2003
Messages
132
I have a table with 2 columns.
I would like to divide all the values in column B into new row based on the char(10) end of line.

Sample table - before:
Product codeDescription
110/1- manual operation
- high voltage
- yellow color
- email notification
110/2- automatic operation
- low voltage
- red color
- SMS notification

<tbody>
</tbody>

Sample table - after:
Product codeDescription
110/1- manual operation
110/1- high voltage
110/1- yellow color
110/1- email notification
110/2- automatic operation
110/2- low voltage
110/2- red color
110/2- SMS notification

<tbody>
</tbody>

Any ideas?

Thanks!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try :
Code:
Sub FT()
Dim rng As Range, cel As Range, r As Variant, s&
Application.ScreenUpdating = False
[A:B].Insert
Set rng = Range([D2], Cells(Rows.Count, "D").End(xlUp))
For Each cel In rng
    r = Split(cel, Chr(10))
    s = UBound(r) - LBound(r) + 1
    With Cells(Rows.Count, "B").End(xlUp)
        .Item(2).Resize(s).Value = Application.Transpose(r)
        .Item(2, 0).Resize(s).Value = cel(1, 0)
    End With
Next
[C:D].Delete
Application.ScreenUpdating = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,650
Messages
6,126,019
Members
449,280
Latest member
Miahr

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