Forum Discussion
Diego Armando Segovia Guatemala
Jan 30, 2018Copper Contributor
Help whit unmerge cells
Help!!!, i need to unmerge cells and reply the value in all cell unmerge cells, but in my sheets i have individual blank cells and they are getting the last value when i use the next vba code:
Sub Descombinar()
With Selection
.UnMerge
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
.Copy
.PasteSpecial xlPasteValues
End With
Application.CutCopyMode = False
End Sub
Thanks for help!
1 Reply
Sort By
- richard danielsCopper Contributor
Not entirely sure what you are trying to do, but this will unmerge all cells in a given range and put the values o the merged cell in to all the cells that were merged.
Public Sub UnmergeCells(ByRef RangeToUnmerge As Range)
'unmerge a range and make all cells the value of the merged cell
Dim cellVal As Variant
cellVal = RangeToUnmerge.Cells(1, 1).Value2
RangeToUnmerge.Unmerge
RangeToUnmerge.Value2 = cellVal
End Sub