my code stock.com

will unmerge all merged cells and fill them with the content of the merged cell.

Note the range in line 7 of the code.

Snippet options

Download: Download snippet as unmergeandfill.vbs.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

Sub UnmergeAndFill()
    Dim Cell As Range
    
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    
    For Each Cell In Range("a1:z10000")
        If Cell.MergeCells = True Then
            Cell.Select
            Cell.MergeCells = False
            Cell.Copy Destination:=Selection
        End If
    Next Cell
    
    Application.ScreenUpdating = True
    Application.EnableEvents = True
    
End Sub

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.