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
|
Option Explicit
Sub repartitionressources()
'Macro pour RPAR'
'Déclaration de variable
Dim R3, premierelignefichier, AA As Integer
Dim V1, V2, V3, i, j As Integer
Dim D1, D2, R0 As Integer
premierelignefichier = 6
AA = 8
'R0= Ressource en k pour l'année
'R1= Ressource mensuelle pour le développement
'R2= ressource mensuelle pour la fin de projet
'D1= durée du projet réalisation en nb de mois
'D2= durée de la partie accompagnant la fin du projet en mois
'V1= variable de début
'V2= variable de fin de réalisation
'V3= variable de fin de projet
'MD= mois début projet UPIT
'MC= Mois du CO
'MF= Mois fin projet
'AA= année en cours
Dim MD As Range
Set MD = Range("G6")
Dim MC As Range
Set MC = Range("I6")
Dim MF As Range
Set MF = Range("K6")
Dim AD As Range
Set AD = Range("H6")
Dim AC As Range
Set AC = Range("J6")
Dim AF As Range
Set AF = Range("L6")
Dim R1 As Range
Set R1 = Range("W6")
Dim R2 As Range
Set R2 = Range("X6")
'Calcul de V2 si le CO a eu lieu l'année d'avant
For i = 6 To 300
For j = 24 To 35
If AC < AA Then
V1 = V2 = ""
End If
If AF > AA Then
V3 = 12
Else
V3 = MF
End If
If AC > AA Then
V1 = ""
V2 = 12 = V3
Else
V2 = MC
MsgBox ("Le CO a eu lieu dans l'année en cours")
End If
'Calcul de V1 et V3 pour un CO pendant l'année
If AD < AA Then
V1 = 0
Else
V1 = MD
End If
If AF > AA Then
V3 = 12
Else
V3 = MF
End If
D1 = V2 - V1
D2 = V3 - V2
If V2 = "" Then
R2 = R0 / D2
End If
If V3 = 1 Then
AD = R2
End If
If V2 = 12 Then
R1 = R0 / D1
Range ("Y"), ("Z"), ("AA"), ("AB"), ("AC") = R1
Else
R1 = (R0 * 0.9) / D1
Range ("Y"), ("Z"), ("AA"), ("AB"), ("AC") = R1
R2 = (R0 * 0.1) / D2
Range ("Y"), ("Z"), ("AA"), ("AB"), ("AC"), ("AD"), ("AE") = R2
autreprojet = premierelignefichier + 1
End Sub |
Partager