如何让excel表格里相同的内容自动合并?请大家帮帮忙,谢谢

2024-12-03 06:37:48
推荐回答(2个)
回答1:

右链凯键SHEET1复制代码空唤枣
Sub MergeSameCells()
Dim lRow As Integer
Application.DisplayAlerts = False
With ActiveSheet
lRow = .Range("A65536").End(xlUp).Row
For i = lRow To 2 Step -1
If .Cells(i, 1).Value = .Cells(i - 1, 1).Value Then
.Range(.Cells(i - 1, 1), .Cells(i, 1)).Merge
End If
Next
End With
Application.DisplayAlerts = True
End Sub
关闭窗斗拆口,按ALT+F8,执行

回答2:

不清楚你需要问什么?