打开EXCEL alt+f11 插入模块 复制下面代码按F5执行 只适合A列~
Sub tt()
Application.DisplayAlerts = False
Dim i, a As Integer
a = 1
For i = 1 To [A1].End(xlDown).Row
If Cells(i, 1) = Cells(i + 1, 1) Then
Else
Range(Cells(a, 1), Cells(i, 1)).Merge
a = 1 + i
End If
Next i
Application.DisplayAlerts = True
End Sub
我的就是自动合并单元格的代码 嘿嘿~~楼上!!
Sub tt()
Application.DisplayAlerts = False
Dim i, a As Integer
a = 1
For i = 1 To [A1].End(xlDown).Row
If Cells(i, 1) = Cells(i + 1, 1) Then
Else
Range(Cells(a, 1), Cells(i, 1)).Merge
a = 1 + i
End If
Next i
Application.DisplayAlerts = True
End Sub
我的就是自动合并单元格的代码 嘿嘿~~楼上!!