Sub test()
Dim i As Long
Dim j As Long
Dim temp As Long
Dim iRow As Long
Dim jRow As Long
i = 2
Do While i < 16
j = i + Cells(i, 1).MergeArea.Rows.Count
Do While j < 16
iRow = Cells(i, 1).MergeArea.Rows.Count
jRow = Cells(j, 1).MergeArea.Rows.Count
If Cells(i + iRow - 1, 3) < Cells(j + jRow - 1, 3) Then
Range("A" & j).Resize(jRow, 3).Cut
Range("A" & i).Insert
End If
j = j + jRow
Loop
i = i + Cells(i, 1).MergeArea.Rows.Count
Loop
End Sub
VBA 合并单元格的排序算法
最新推荐文章于 2025-03-13 22:23:38 发布