Bonjour,
j'ai un code qui fonctionne bien de KIOUANE mais un peu long à exécuter.
Dans la barre d'état, je vois qu'il a calculé sur 197706 cellules.
Je souhaite mettre une plage de cellule pour aller plus vite.
Mon tableau ne change jamais, il va de A3 à E400.
Pouvez-vous m'aider SVP.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
40 Sub tri() Application.ScreenUpdating = False Dim a, b As Integer 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 Cells(i, 1).EntireRow.Cut Cells(i + y + 1, 1).Select Selection.Insert Shift:=xlDown Exit For End If Next End If Next Next Next End Sub
Partager