Sub creer_test()
valeurs
formules
End Sub
Private Sub valeurs()
Cells.Clear
[A3:A6] = 1: [A7:A11] = 2: [A12:A18] = 3: [A19:A28]=4
'ne pas tenir compte de ces formules, c'est juste pour simuler une saisie de valeurs
Range("H3:H28").FormulaR1C1 = "=RAND()*ROW()/10"
Range("J3:J28").FormulaR1C1 = "=RAND()*ROW()/COLUMN()"
Range("R3:R28").FormulaR1C1 = "=ROW()*PI()/3"
Range("S3:S28").FormulaR1C1 = "=ROW()/RAND()^2/17"
Range("W3:W28").FormulaR1C1 = "=ROW()*PI()/COLUMN()"
Range("X3:X28").FormulaR1C1 = "=ROW()/RAND()^2/19"
ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value
End Sub
Private Sub formules()
'ci-dessous les formules originales (sauf pour le MIN)
'les adresses des cellules des formules sont les bonnes
'le tableau commence en ligne 3
[T3].Formula = "=(H3*R3)+(S3*2)"
[U3].FormulaArray = "=MIN(IF($A$3:$A$282=$A3,$T$3:$T$282))"
[V3].Formula = "=13*U$3/T3"
[Y3].Formula = "=(J3*W3)+(X3*2)"
[Z3].Formula = "=MIN(IF($A$3:$A$282=$A3,$Y$3:$Y$282))"
[AA3].Formula = "=13*Z$3/Y3"
[AD3].Formula = "=(L3*AB3)+(AC3*2)"
[AE3].FormulaArray = "=MIN(IF($A$3:$A$282=$A3,$AD$3:$AD$282))"
[AF3].Formula = "=13*AE$3/AD3"
[AI3].Formula = "=(N3*AG3)+(AH3*2)"
[AJ3].FormulaArray = "=MIN(IF($A$3:$A$282=$A3,$AI$3:$AI$282))"
[AK3].Formula = "=13*AJ$3/AI3"
[AN3].Formula = "=(P3*AL3)+(AM3*2)"
[AO3].FormulaArray = "=MIN(IF($A$3:$A$282=$A3,$AN$3:$AN$282))"
[AP3].Formula = "=13*AO$3/AN3"
[AQ3].Formula = "=AVERAGE(V3,AA3,AF3,AK3,AP3)"
[AV3].Formula = "=SUM(AQ3:AU3)"
End Sub