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
| Public A As Single
Public jour As Single
Public nbreJour As Single
Sub LesBesoins()
If ActiveSheet.Name = "Feuil2" Then
nbreJour = 30
For jour = 0 To nbreJour
If Worksheets("Feuil2").Range("CA4").Offset(0, jour) = "Jeu" Or Worksheets("Feuil2").Range("CA4").Offset(0, jour) = "Sam" Then 'ligne 0 + 3
For A = 1 To 40
'Calcul des besoins matin
Worksheets("Feuil2").Range("CA50").Offset(0, jour) = Worksheets("Feuil1").Range("C" & 4) 'Résultat matin
'Calcul des besoins
If Worksheets("Feuil2").Range("CA62").Offset(0, jour) = Worksheets("Feuil1").Range("D" & A + 3) And _
Worksheets("Feuil2").Range("CA63").Offset(0, jour) = Worksheets("Feuil1").Range("E" & A + 3) And _
Worksheets("Feuil2").Range("CA64").Offset(0, jour) = Worksheets("Feuil1").Range("F" & A + 3) And _
Worksheets("Feuil2").Range("CA65").Offset(0, jour) = Worksheets("Feuil1").Range("G" & A + 3) And _
Worksheets("Feuil2").Range("CA66").Offset(0, jour) = Worksheets("Feuil1").Range("H" & A + 3) And _
Worksheets("Feuil2").Range("CA67").Offset(0, jour) = Worksheets("Feuil1").Range("I" & A + 3) And _
Worksheets("Feuil2").Range("CA68").Offset(0, jour) = Worksheets("Feuil1").Range("J" & A + 3) And _
Worksheets("Feuil2").Range("CA69").Offset(0, jour) = Worksheets("Feuil1").Range("K" & A + 3) And _
Worksheets("Feuil2").Range("CA70").Offset(0, jour) = Worksheets("Feuil1").Range("L" & A + 3) And _
Worksheets("Feuil2").Range("CA71").Offset(0, jour) = Worksheets("Feuil1").Range("M" & A + 3) And _
Worksheets("Feuil2").Range("CA72").Offset(0, jour) = Worksheets("Feuil1").Range("N" & A + 3) And _
Worksheets("Feuil2").Range("CA73").Offset(0, jour) = Worksheets("Feuil1").Range("O" & A + 3) And _
Worksheets("Feuil2").Range("CA70").Offset(0, jour) = Worksheets("Feuil1").Range("L" & A + 3) And _
Worksheets("Feuil2").Range("CA71").Offset(0, jour) = Worksheets("Feuil1").Range("M" & A + 3) And _
Worksheets("Feuil2").Range("CA72").Offset(0, jour) = Worksheets("Feuil1").Range("N" & A + 3) And _
Worksheets("Feuil2").Range("CA73").Offset(0, jour) = Worksheets("Feuil1").Range("O" & A + 3) And _
Worksheets("Feuil2").Range("CA74").Offset(0, jour) = Worksheets("Feuil1").Range("P" & A + 3) And _
Worksheets("Feuil2").Range("CA75").Offset(0, jour) = Worksheets("Feuil1").Range("Q" & A + 3) And _
Worksheets("Feuil2").Range("CA76").Offset(0, jour) = Worksheets("Feuil1").Range("R" & A + 3) And _
Worksheets("Feuil2").Range("CA77").Offset(0, jour) = Worksheets("Feuil1").Range("S" & A + 3) Then _
Worksheets("Feuil2").Range("CA51").Offset(0, jour) = Worksheets("Feuil1").Range("T" & A + 3) 'Résultat avant diurne
Next A
End If
Next jour
End If
End Sub |
Partager