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 54 55 56 57 58 59 60
| Sub Exemple()
t = Timer
Dim tableau0
Dim tableau1
Dim tableau2(1 To 200, 1 To 100)
Dim derniereLigne As Integer
Dim I As Integer
With Sheets("Exercice")
derniereLigne = .Cells(Rows.Count, 1).End(xlUp).Row
tableau0 = .Range("A1:B" & derniereLigne).Value
tableau1 = tableau0
ReDim Preserve tableau1(1 To UBound(tableau0), 1 To 202)
For K = 2 To 200
For j = K - 1 To UBound(tableau1)
Somme = 0
For I = j + 2 - K To j
Somme = Somme + tableau1(I, 1)
tableau1(j, K + 2) = Somme / K
Next
Next
Next
For K = 1 To 200
For L = 1 To 100
For I = 2 To UBound(tableau1)
For j = K To K
If tableau1(I, j + 2) > tableau1(I - 1, j + 2) And tableau1(I, 2) > L Then
tableau1(I, 3) = 1
End If
a = 0
If tableau1(I, 3) = 1 Then
a = a + tableau1(I, 3)
End If
Next
Next
tableau2(K, L) = a
Next
Next
.Range("S1").Resize(UBound(tableau2, 1), UBound(tableau2, 2)).Value = tableau2
End With
MsgBox Timer - t
End Sub |
Partager