Bonjour à tous,
Sub num_ordreDecroissant()
Dim I As Long, N As Long
Dim HeureDebut, HeureFin, TempsTotal
HeureDebut = Timer
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
N = Range("A" & Rows.Count).End(xlUp).Row - 1
For I = 2 To Range("A" & Rows.Count).End(xlUp).Row
Cells(I, 13) = N
N = N - 1
Next I
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
HeureFin = Timer
TempsTotal = HeureFin - HeureDebut
Debug.Print "Temps total : " & Round(TempsTotal, 0) & " seconde(s)"
End Sub
Ou :
Sub num_ordreDecroissant2()
Dim I As Long, N As Long
Dim HeureDebut, HeureFin, TempsTotal
HeureDebut = Timer
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
N = Range("A" & Rows.Count).End(xlUp).Row - 1
Cells(2, 13) = N
With Range(Cells(3, 13), Cells(N + 1, 13))
.Formula2R1C1 = "=R[-1]C-1"
.Copy
.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With
With Application
.ScreenUpdating = True
' .Calculation = xlCalculationAutomatic
End With
HeureFin = Timer
TempsTotal = HeureFin - HeureDebut
Debug.Print "Temps total : " & Round(TempsTotal, 0) & " seconde(s)"
End Sub