EXCEL vba 合并相同单元格

Sub Macro1()
' Macro1 Macro
' 快捷键: Ctrl+Shift+A
Application.Goto Reference:="Macro1"
Application.DisplayAlerts = False
For i = [a65536].End(3).Row To 2 Step -1
If Cells(i - 1, 1) = Cells(i, 1) Then
Range(Cells(i - 1, 1), Cells(i, 1)).Merge
End If
Next
For i = [a65536].End(3).Row To 2 Step -1
If Cells(i - 1, 7) = Cells(i, 7) Then
Range(Cells(i - 1, 7), Cells(i, 7)).Merge
End If
Next
Application.DisplayAlerts = True
End Sub

posted @ 2017-09-28 12:55  yizongxing  阅读(2435)  评论(0编辑  收藏  举报