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
| Sub estimation()
Application.ScreenUpdating = False
Application.Calculation = xlManual
Dim DebColonne As Integer
Dim FinColonne As Integer
Dim LigneEs As Integer
Dim LigneFinTab As Integer
Dim DbCalendrierNS As Integer
Dim i As Integer
Dim w As Integer
DebColonne = Val(InputBox("Quel week renseigner ?"))
If DebColonne = 0 Then Exit Sub
LigneEs = Val(InputBox("Quel Ligne ?"))
If LigneEs = 0 Then Exit Sub
Sheets("Parametres").Cells(22, 2).Value = DebColonne + 5
FinColonne = Sheets("Parametres").Cells(23, 2).Value
FinColonneNS = Sheets("Parametres").Cells(24, 2).Value
Sheets("Parametres").Cells(25, 2).Value = LigneEs
LigneFinTab = Sheets("Parametres").Cells(27, 2).Value
DbCalendrierNS = Sheets("Parametres").Cells(28, 2).Value
w = Sheets("Parametres").Range("B20").Value
For m = 8 To Worksheets.Count
If Worksheets(m).Cells(w, 2) = "" Then Exit Sub
With Worksheets(m)
' ANNEE N
For i = DebColonne + 5 To FinColonne - 1
.Cells(LigneEs, i).FormulaLocal = "=INDEX(Temp1!$A$1:$DT$80;EQUIV(B" & w & ";Temp1!$A$1:$A$80;0)+1;" & i & ")"
'.Cells(LigneEs, i).Value = .Cells(LigneEs, i).Value
Next i
' ANNEE N+1
For i = DbCalendrierNS To FinColonneNS
.Cells(LigneEs, i).FormulaLocal = "=SI(B" & w & " = """";"""";INDEX(Temp1!$A$1:$DT$80;EQUIV(B" & w & ";Temp1!$A$1:$A$80;0)+1;" & i - 1 & "))"
'.Cells(LigneEs, i).Value = .Cells(LigneEs, i).Value
Next i
End With
Next m
Application.Calculation = xlCalculationAutomatic
End Sub |
Partager