• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to un merge cell if they are merged

ThrottleWorks

Excel Ninja
Hi,

I have a table. In this table, values in one particular column might be merged.
If they are merged, I want to un merge it.

Please refer attached file for more details.
Can anyone please help me in this.
 

Attachments

  • Chandoo.xls
    25.5 KB · Views: 5
Last edited:
Something like this?
Code:
Sub test()
Dim cel As Range
Dim lRow As Long

lRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each cel In Range("D2:D" & lRow)
    If cel.MergeCells Then
        cel.UnMerge
        cel.Offset(1).Value = cel.Value
    End If
Next

End Sub

Edit: If there's more than 2 rows merged. You'd probably want another step inside IF statement to store # of merged rows and loop on Offset().
 
Last edited:
Really sorry for late repky sir. Am checking this and will revert with details. Thanks for the help. Have a nice weekend.
 
Back
Top