发布网友 发布时间:2022-05-05 08:13
共4个回答
热心网友 时间:2022-06-18 19:38
就你目前的截图,代码如下:
Sub test()
Dim i, irow As Integer
irow = Range("e65536").End(xlUp).Row
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For i = irow To 7 Step -1
If Cells(i, 5) <> "" And Cells(i + 1, 5) <> "" And Cells(i, 5) = Cells(i + 1, 5) Then
Range(Cells(i + 1, 5), Cells(i, 5)).Merge
End If
Next
Range(Cells(6, 5), Cells(irow, 5)).HorizontalAlignment = xlCenter
Range(Cells(6, 5), Cells(irow, 5)).VerticalAlignment = xlCenter
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
热心网友 时间:2022-06-18 20:56
万能处理
Excel数据重复或+空格怎样批量合并单元格
热心网友 时间:2022-06-18 22:30
Sub hb()热心网友 时间:2022-06-19 00:22
为什么要用VBA呢?用分类汇总、定位合并单元格不一样能解决这个问题?