单元格合并拆分
Sub 合并单元格()
'前后单元格值相同合并
Application.DisplayAlerts = False
On Error Resume Next
With Selection
For i = .Count To 1 Step -1
If .Cells(i) = .Cells(i - 1) And .Cells(i) <> "" Then
Range(.Cells(i), .Cells(i - 1)).Merge
End If
Next i
End With
End Sub
Sub 单元格拆分()
Dim MR As Range
Selection.UnMerge
For Each MR In Selection
If MR = "" Then
MR = MR.Offset(-1, 0).Value
End If
Next
End Sub
赞 (0)