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 41 42 43 44 45 46 47 48 49 50 51 52 53
| Sub TableauLuEnBloc()
m = Timer
Dim t1
maxi = 100000
'lire en bloc le contenu d'une plage de plusieurs cellules dans un tableau variant
t1 = Cells(1, 1).Resize(maxi, 10).Value
Cells(1, 5).Resize(UBound(t1, 1), UBound(t1, 2)).Value = t1
dur = Timer - m
Debug.Print "Lecture en bloc "; dur
End Sub
Sub TableauDeDouble()
m = Timer
maxi = 100000
ReDim t1(1 To maxi, 1 To 10) As Double
'Lecture cellule par cellule vers un tableau Double
For r = 1 To UBound(t1, 1)
For L = 1 To UBound(t1, 2)
t1(r, L) = Cells(r, L)
Next
Next
Cells(1, 5).Resize(UBound(t1, 1), UBound(t1, 2)).Value = t1
dur = Timer - m
Debug.Print "Double "; dur
End Sub
Sub TableauDeVariant()
m = Timer
maxi = 100000
ReDim t1(1 To maxi, 1 To 10) As Double
'Lecture cellule par cellule vers un tableau Variant
For r = 1 To UBound(t1, 1)
For L = 1 To UBound(t1, 2)
t1(r, L) = Cells(r, L)
Next
Next
Cells(1, 5).Resize(UBound(t1, 1), UBound(t1, 2)).Value = t1
dur = Timer - m
Debug.Print "Variant "; dur
End Sub |
Partager