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
| Mes deux tables:
Ratio_GPAE_Jour
128,3000031
28,39999962
128,3000031
Ratio_GPAE_An
26667
5900
30000
Sub Calcul()
Dim PLigVide As Integer, PColVide As Integer, LigRatio As Integer
Dim TailleT As Integer, J As Integer, K As Integer
Worksheets("EDataBase").Activate
PLigVide = Columns(1).Find("", [A65536], , , xlByRows, xlNext).Row
PColVide = Cells(1, Rows(1).Cells.Count).End(xlToLeft).Column
TailleT = (PLigVide - 3)
'** Définit la taille des tableaux
ReDim TRatAn(TailleT)
ReDim TRatJour(TailleT)
'** Alimente les tableaux suivant les champs "Ratio_GPAE_An"
J = 0
For Col = 1 To PColVide
If Cells(1, Col).Value = "Ratio_GPAE_An" Then
For LigRatio = 2 To PLigVide - 1
TRatAn(J) = Cells(LigRatio, Col).Value
J = J + 1
Next LigRatio
End If
Next Col
'** Alimente les tableaux suivant les champs "Ratio_GPAE_Jour"
J = 0
For Col = 1 To PColVide
If Cells(1, Col).Value = "Ratio_GPAE_Jour" Then
For LigRatio = 2 To PLigVide - 1
TRatJour(J) = Cells(LigRatio, Col).Value
J = J + 1
Next LigRatio
End If
Next Col
For K = 0 To UBound(TRatAn())
Cells(10, (K + 2)) = TRatAn(K)
Next K
For K = 0 To UBound(TRatJour())
Cells(12, K + 2).Formula = "=" & Cells(10, K + 2).Address & "/" & TRatJour(K) '** l'erreur d"'execution 1004 se situe ici
Next K
End Sub |
Partager