|
发表于 2010-7-22 07:32
|
显示全部楼层
本楼为最佳答案
Sub tt() Dim Rcount% With Sheet1 For n = Sheet1.[a65536].End(xlUp).Row To 2 Step -1 If .Cells(n, 2) = .Cells(n - 1, 2) Then Rcount = .Cells(n, 1) - .Cells(n - 1, 1) If Rcount > 1 Then Rows(n & ":" & n + Rcount - 2).Insert shift:=xlDown For i = n To n - 2 + Rcount .Cells(i, 1) = .Cells(i - 1, 1) + 1 .Cells(i, 2) = .Cells(i - 1, 2) Next End If End If Next End With End Sub |
|