Breaking up cell's content into separate rows

drkidd22

New member
Joined
Nov 18, 2013
Messages
1
Reaction score
0
Points
0
Hello,

I have a workbook with a bunch of data that I need to break up into separate cells in order to be able to sort. currently a single cell may contain 1, 2, 3, line items, I want to be ale to put them in single rows/cells. I already tried but it's not working properly, see attached file.
 

Attachments

  • Book2.xlsm
    20.2 KB · Views: 18

snb

New member
Joined
May 15, 2013
Messages
376
Reaction score
0
Points
0
Website
www.snb-vba.eu
Excel Version(s)
2020
Code:
Sub M_snb()
     sn = Cells(1).CurrentRegion

     For j = 1 To UBound(sn, 2)
        sp = Split(Join(Application.Transpose(Application.Index(sn, 0, j)), vbLf), vbLf)
        Cells(1, j).Resize(UBound(sp) + 1) = Application.Transpose(sp)
     Next
End Sub
 
Top