I found the following code on this site to be very helpful
Public Sub UnmergeAndFill()
With Selection
If .MergeCells Then
.MergeCells = False
Selection.Cells(1, 1).Copy
ActiveSheet.Paste 'Or PasteSpecial xlPasteFormulasAndNumberFormats
End If
End With
End Sub
I am trying to get it to perform this action across all worksheets in a workbook with no luck.
Here is what I have. It still seems to only do the action on the active worksheet. Any help would be greatly appreciated.
Sub UnmergeAndFill()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With Selection
If .MergeCells Then
.MergeCells = False
.Selection.Cells(1, 1).Copy
.ActiveSheet.Paste 'Or PasteSpecial xlPasteFormulasAndNumberFormats
End If
End With
Next ws
End Sub