Hello Excellers and welcome to some more #macromonday fun. Today let’s look at how to use Excel VBA macro to un-merge cells in our Excel worksheet. As working with merged cells can be tricky you may want to avoid them altogether. If you want to read more of my blog posts on merged cells you can do so below.
Related Blog Posts On Merged Cells
What Does The Macro Do?
This piece of code is really simple and is designed to remove the merged property from a range of cells selected by the user.
How Does It Work?
This macro uses unmerge method which separates a merged area into individual cells. So let’s get coding. First, we need to open Visual Basic – by hitting ALT +F11 or Developer Tab – Visual Basic – Insert Menu – Module
Step 1. Declare Our Variables. We have one two Object Variables in this code. We are declaring the active worksheet and the range of cells.
Dim ActWorksheet As Worksheet
Dim MyRange As Range
Step 2. We now store the current worksheet and the selected range of cells.
Step 3. We now un-merge any merged cells in the selected cell range, the macro now ends.
That’s it now time to test the macro!
Want To Copy The Code?
If you want to see all of my blog posts in the Macro Mondays Series you can find them all in the link below. Why not bookmark it?, Yes it is updated EVERY Monday.