Skip to content

Instantly share code, notes, and snippets.

@zhimiaoli
Last active January 2, 2016 21:49
Show Gist options
  • Save zhimiaoli/8365813 to your computer and use it in GitHub Desktop.
Save zhimiaoli/8365813 to your computer and use it in GitHub Desktop.
取消Excel中合并单元格的代码
Sub UnMergeFill()
'from http://stackoverflow.com/questions/9215022/unmerging-excel-rows-and-duplicate-data
Dim cell As Range, joinedCells As Range
on error resume next
For Each cell In ThisWorkbook.ActiveSheet.UsedRange
If cell.MergeCells Then
Set joinedCells = cell.MergeArea
cell.MergeCells = False
joinedCells.Value = cell.Value
End If
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment