Question : Unmerge cell and split into rows

Hi dear Experts,

I've been searching for a while but could not lay my finger on a ready answer.
In attached sheet data is organized per row, some cells icontain merged data.
In order to work with that data those values should be unmerged and spllit into rows.
The relevant column is B. It has a pendant in column G. Merged data in other cells can be unmerged too if that would simplify things a bit.
I hope the example makes things clear, and also that this is possible.
Thanks.
Attachments:
 
Merge to unmerge example
 

Answer : Unmerge cell and split into rows

Assuming that you have headings in Row 1 for all the columns you car about, this seems to be working.  It "unmerges" all of the cells.  (The cells are not truly merged in the Excel sense, of course...)

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
Sub RedoList()
    
    Dim LastR As Long, LastC As Long
    Dim arr As Variant
    Dim r As Long, c As Long
    Dim CellContents As Variant
    Dim MaxRows As Long
    Dim DestR As Long
    
    With ActiveSheet
        LastR = .Cells(.Rows.Count, 1).End(xlUp).Row
        LastC = .Cells(1, .Columns.Count).End(xlToLeft).Column
        arr = .Range(.Cells(1, 1), .Cells(LastR, LastC)).Value
    End With
    
    Worksheets.Add
    DestR = 1
    
    For r = 1 To UBound(arr, 1)
        MaxRows = 0
        For c = 1 To UBound(arr, 2)
            If arr(r, c) <> "" Then
                CellContents = Split(arr(r, c), Chr(10))
                Cells(DestR, c).Resize(UBound(CellContents) + 1, 1) = Application.Transpose(CellContents)
                If (UBound(CellContents) + 1) > MaxRows Then MaxRows = (UBound(CellContents) + 1)
            End If
        Next
        DestR = DestR + MaxRows
    Next
    
    MsgBox "Done"
    
End Sub
Random Solutions  
 
programming4us programming4us