Learnings

Friday, February 26, 2010

Unmerge cells in Excel and copy value into all cells

Sub x()

Dim rng As Range, rng2 As Range

For Each rng In ActiveSheet.UsedRange
If rng.MergeCells Then
With rng
Set rng2 = .MergeArea
.MergeArea.UnMerge
rng2.Value = .Value
End With
End If
Next rng

End Sub

0 Comments:

Post a Comment

<< Home