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
| Option Explicit
Public Declare Function GetTickCount Lib "kernel32" () As Long
Sub Macro8()
Dim deb1 As Long, deb2 As Long
Dim fin1 As Long, fin2 As Long
Dim i As Integer, j As Integer
Application.ScreenUpdating = False
Cells.ClearContents
deb1 = GetTickCount
For i = 1 To 100
For j = 1 To 10
Cells(i, j).Select
Selection.Value = i + j
Next j
Next i
fin1 = GetTickCount
Cells.ClearContents
deb2 = GetTickCount
For i = 1 To 100
For j = 1 To 10
Cells(i, j).Value = i + j
Next j
Next i
fin2 = GetTickCount
Application.ScreenUpdating = True
MsgBox "Avec les select " & fin1 - deb1 & " ms" & Chr(13) & "En direct " & fin2 - deb2 & " ms" & Chr(13) & " soit un facteur " & (fin1 - deb1) / (fin2 - deb2)
End Sub |