Select Merged Cells and Unmerge Spread Merge Data To All Cells

  • Thread starter rtwiss via OfficeKB.com
  • Start date
R

rtwiss via OfficeKB.com

This is the start:

Sub findmerged()
Dim c
For Each c In ActiveSheet.UsedRange
If c.MergeCells Then
MsgBox c.Address & " is merged"
End If
Next
End Sub

Sub Unmerge()
Dim rng As Range, rngtot As Range, rngval As Variant
Dim strtrow As Long, endrow As Long, col As Long

strtrow = Selection.Row
col = Selection.Column
endrow = Application.WorksheetFunction.Min(Selection.End(xlDown).Row - 1,
Cells(65536, col).End(xlUp).Row + 1)
rngval = Selection.Value

Set rngtot = Range(Cells(strtrow, col), Cells(endrow, col))

ActiveCell.Unmerge
For Each rng In rngtot
rng.Value = rngval
Next rng

End Sub
 
R

RyanH

What is the problem you are having? Do you have a question? Indicate where
the error is and what type of error?
 
R

rtwiss via OfficeKB.com

trying to select all merged cells on sheet then unmerge each merge cell and
spread merge data to all cells in each merged cell. You follow?
What is the problem you are having? Do you have a question? Indicate where
the error is and what type of error?
This is the start:
[quoted text clipped - 25 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top