Consulting

Results 1 to 3 of 3

Thread: Unmerge cells across rows only not across columns

  1. #1

    Unmerge cells across rows only not across columns

    Hello everyone
    I have merged cells across columns .. In attachment : Columns B:F are merged & columns G:K are merged & columns L:S are merged
    My request is to keep the merged cells across columns but to unmerge cells across rows (as in the yellow range)
    the yellow range is B3:F6 and I need to unmerge that part (this is just an example as I have a lot of parts) ...The final result would be :
    B3:F3 (To be merged) & B4:F4 (To be merged) & B5:F5 (To be merged) & B6:F6 (To be merged)

    Hope it is clear
    Thanks advanced for any help
    Attached Files Attached Files

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Sub Test()
        For Each cel In ActiveSheet.UsedRange
            If cel.MergeArea.Rows.Count > 1 Then
                Set r = cel.MergeArea
                r.UnMerge
                For i = 1 To r.Rows.Count
                   r.Rows(i).Merge
                Next
            End If
        Next
    End Sub
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    That's awesome Mr. MD
    Thank you very much for this fascinating solution ...
    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •