#If VBA7 Then
Private Declare PtrSafe Function QueryPerformanceFrequency Lib "kernel32" (X As Currency) As Boolean
Private Declare PtrSafe Function QueryPerformanceCounter Lib "kernel32" (X As Currency) As Boolean
#Else
Private Declare Function QueryPerformanceFrequency Lib "kernel32" (X As Currency) As Boolean
Private Declare Function QueryPerformanceCounter Lib "kernel32" (X As Currency) As Boolean
#End If
Private PCtrLancmt As Currency
Public TempsSecondes As Double
Sub LancerChrono()
QueryPerformanceCounter PCtrLancmt
End Sub
Function StopChrono() As Double
Dim PCtrActuel As Currency, Freq As Currency
QueryPerformanceCounter PCtrActuel
QueryPerformanceFrequency Freq
TempsSecondes = (PCtrActuel - PCtrLancmt) / Freq
End Function
Sub test()
Dim I&, C&, X&, col&, Lig&, tbl(), tmp
Randomize
LancerChrono
ReDim Preserve tbl(1 To 10, 1 To 70)
For C = 1 To 70: For I = 1 To 10: tbl(I, C) = C: Next: Next
For I = 1 To 10
For C = 1 To 8
col = Int(1 + (Rnd * 70))
tmp = tbl(I, C): tbl(I, C) = tbl(I, col): tbl(I, col) = tmp
Next
Next
StopChrono
[u6].Resize(10, 8) = tbl
MsgBox Format(TempsSecondes, "#0.0000")
End Sub