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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
| ActiveWorkbook.Protect Structure:=False
Set newSheet2 = Sheets.Add
newSheet2.Name = "Calcul2"
ActiveWorkbook.Protect Structure:=True
'boucle ingénieur
heure_totale = 0
Call hypothese(debut_hyp, "ING")
heure_totale_ing = heure_totale
'boucle at
heure_totale = 0
Call hypothese(hypothese_stop, "AT")
heure_totale_at = heure_totale
'boucle stag
heure_totale = 0
Call hypothese(hypothese_stop, "Stagiaire")
heure_totale_stag = heure_totale
Cells(hypothese_stop + 1, 4).FormulaR1C1 = "=sum(R[" & (debut_hyp - hypothese_stop - 1) & "]C[0]:R[-1]C[0])"
newSheet2.Activate
ActiveWorkbook.Protect Structure:=False
Application.DisplayAlerts = False
Worksheets(newSheet2.Name).Delete
Application.DisplayAlerts = True
ActiveWorkbook.Protect Structure:=True
'hypothèse sous traitance
Cells(hypothese_stop + 3, 1).Value = "Hypothèses effectif sous traitant:"
debut_hyp_sst = hypothese_stop + 3
'titre colonne
Cells(debut_hyp_sst + 1, 2).Value = "Nb h travaillées"
Cells(debut_hyp_sst + 1, 2).Select
Selection.Interior.ColorIndex = 42
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
'Copie sous traitance
heure_totale = 0
f = 2
Do
vide = IsEmpty(Worksheets("Parametres").Cells(f, 7))
f = f + 1
Loop While vide = 0
cellulevide = f - 2
For f = 2 To cellulevide
Worksheets("Prevision").Cells(debut_hyp_sst + f, 1).Value = Worksheets("Parametres").Cells(f, 7)
Worksheets("Prevision").Cells(debut_hyp_sst + f, 1).Interior.ColorIndex = 42
Worksheets("Prevision").Cells(debut_hyp_sst + f, 2).Value = Worksheets("Parametres").Cells(f, 8)
Worksheets("Prevision").Cells(debut_hyp_sst + f, 2).HorizontalAlignment = xlCenter
heure_totale = Worksheets("Parametres").Cells(f, 8) + heure_totale
Next
heure_totale_sst = heure_totale
Worksheets("Prevision").Cells(debut_hyp_sst + f, 1).Value = "Total"
Worksheets("Prevision").Cells(debut_hyp_sst + f, 1).Interior.ColorIndex = 42
Worksheets("Prevision").Cells(debut_hyp_sst + f, 2).Value = heure_totale_sst
Worksheets("Prevision").Cells(debut_hyp_sst + f, 2).HorizontalAlignment = xlCenter
fin_sst = debut_hyp_sst + f
'calcul heures potentielles
Cells(debut_potentiel, 2).Value = heure_totale_ing
Cells(debut_potentiel, 2).HorizontalAlignment = xlCenter
Cells(debut_potentiel, 3).Value = heure_totale_at
Cells(debut_potentiel, 3).HorizontalAlignment = xlCenter
Cells(debut_potentiel, 4).Value = heure_totale_stag
Cells(debut_potentiel, 4).HorizontalAlignment = xlCenter
Cells(debut_potentiel + 1, 2).FormulaR1C1 = "=R[-4]C[0]-R[-1]C[0]"
Cells(debut_potentiel + 1, 2).HorizontalAlignment = xlCenter
Cells(debut_potentiel + 1, 3).FormulaR1C1 = "=R[-4]C[0]-R[-1]C[0]"
Cells(debut_potentiel + 1, 3).HorizontalAlignment = xlCenter
Cells(debut_potentiel + 1, 4).FormulaR1C1 = "=R[-4]C[0]-R[-1]C[0]"
Cells(debut_potentiel + 1, 4).HorizontalAlignment = xlCenter
Cells(debut_potentiel + 2, 2).Formula = "=B" & (debut_potentiel + 1) & "/C" & (debut_potentiel + 7)
Cells(debut_potentiel + 2, 2).HorizontalAlignment = xlCenter
Cells(debut_potentiel + 2, 2).NumberFormat = "0.00"
Cells(debut_potentiel + 2, 3).Formula = "=C" & (debut_potentiel + 1) & "/C" & (debut_potentiel + 7)
Cells(debut_potentiel + 2, 3).HorizontalAlignment = xlCenter
Cells(debut_potentiel + 2, 3).NumberFormat = "0.00"
Cells(debut_potentiel + 2, 4).Formula = "=D" & (debut_potentiel + 1) & "/C" & (debut_potentiel + 7)
Cells(debut_potentiel + 2, 4).HorizontalAlignment = xlCenter
Cells(debut_potentiel + 2, 4).NumberFormat = "0.00"
End Sub |
Partager