Unmerge cells using Vba code.

omairhe

Well-known Member
Joined
Mar 26, 2009
Messages
1,837
Office Version
  1. 2019
Platform
  1. Windows
Hello,


How do you unmerge cells from an active sheet of a workbook.


I could manage to alter the following code I found from an online forum. But could someone please verify if this would work at all or come up with even better alternative?


Code:
Sub UnMergeFill()


Dim cell As Range, joinedCells As Range


For Each cell In ThisWorkbook.ActiveSheet.UsedRange
    If cell.MergeCells Then
        cell.MergeCells = False
    End If
Next
End Sub

Thank you.
 
Last edited:

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
46,340
Office Version
  1. 365
Platform
  1. Windows
Best way of finding out if it works, is try it ;)
 

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,770
Office Version
  1. 2010
Platform
  1. Windows
Code:
Sub UnMergeFill()
  Cells.UnMerge
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,109,021
Messages
5,526,301
Members
409,694
Latest member
bastos21

This Week's Hot Topics

Top