合并单元格拆分,并把第一个单元格的值赋给所有被合并单元格
Sub unmergeRange() Dim rg As Range With ActiveSheet Set rg = .UsedRange rowmax = rg.Rows.Count columnmax = rg.Columns.Count For i = 2 To rowmax For j = 1 To columnmax If .Cells(i, j).MergeCells Then Call UnMergeFunction(.Cells(i, j).MergeArea) End If Next Next End With MsgBox "OK" End Sub Sub UnMergeFunction(ra As Range) 'unmerge the merged range, input the first value into all the merged cells With ra aaa = .Cells(1).Value .unmerge For Each Ce In .Cells Ce.Value = aaa Next End With End Sub