1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Sub tri()
Application.ScreenUpdating = False
With Sheets("TRI")
n = .Range("A" & Rows.Count).End(xlUp).Row
.Range("A3:E" & n).Sort Key1:=Range("B3:B400"), Order1:=xlDescending, Header:= _
xlNo, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
End With
For v = 12 To 408 Step 11
For j = 1 To 13
For i = n - 1 To 3 Step -1
If Cells(i, 1).Value = v Then
For y = 1 To n - i
If Cells(i + y, 1).Value < v Then
Application.CutCopyMode = False
Range(Cells(i, 1),cells(i,5)).Cut
Cells(i + y + 1, 1).Select
Selection.Insert Shift:=xlDown
Exit For
End If
Next
End If
Next
Next
Next
Application.ScreenUpdating = True
End Sub |