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
| Sub calcul()
Dim l, a, j, k As Integer
With ThisWorkbook.Sheets("CDR Ensemble Personnel")
k = 6
l = .Range("B" & k).End(xlDown).Row 'Permet de se positionner sur la dernière ligne du tableau NON VIDE
For i = 6 To l - 1
.Range("B" & i + 1).FormulaR1C1 = "=SUMIFS(Primes!C[5],Primes!C[4],'CDR Ensemble Personnel'!RC[-1],Primes!C[2],'CDR Ensemble Personnel'!R3C4,Primes!C[12],'CDR Ensemble Personnel'!R1C1)"
.Range("B" & l).FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
.Range("C" & i + 1).FormulaR1C1 = "='CDR Global'!RC*RC[-1]/'CDR Global'!RC[-1]"
.Range("C" & l).FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
.Range("D" & i + 1).FormulaR1C1 = "=(RC[-1]+RC[-2])*'Liste des critères de sélection'!R12C2"
.Range("D" & l).FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
Next
a = 17
j = .Range("B" & a).End(xlDown).Row 'Permet de se positionner sur la dernière ligne du tableau NON VIDE
For i = 17 To j - 1
.Range("B" & i + 1).FormulaR1C1 = "=SUMIFS(Primes!C[5],Primes!C[4],'CDR Ensemble Personnel'!RC[-1],Primes!C[2],'CDR Ensemble Personnel'!R14C4,Primes!C[12],'CDR Ensemble Personnel'!R1C1)"
.Range("B" & j).FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
.Range("C" & i + 1).FormulaR1C1 = "='CDR Global'!RC*RC[-1]/'CDR Global'!RC[-1]"
.Range("C" & j).FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
.Range("D" & i + 1).FormulaR1C1 = "=(RC[-1]+RC[-2])*'Liste des critères de sélection'!R12C5"
.Range("D" & j).FormulaR1C1 = "=SUM(R[-4]C:R[-1]C)"
Next
End With
End Sub |
Partager