Sub selection_call()
Dim T 'Variable qui représente le nombre de jours restant, T(n+1)=T(n) - 1
Dim pc
Dim starting_date
i = 1
dt = 1
starting_date = Cells(2, 14) '1er jour
ReDim pc(0 To 7)
ReDim T(0 To 7)
Do
i = i + 1
Loop Until Cells(i, 1) = starting_date
pc(0) = Cells(i, 3).Value
K = Cells(i, 4).Value
T(0) = Cells(i, 8).Value
Cells(3, 16) = pc(0)
Cells(3, 17) = Cells(i + 1, 1).Value
Cells(3, 18) = T(0)
For j = 1 To 5 'durée d'observation
starting_date = IIf(j > 4, starting_date + 3, starting_date + 1)
Do
i = i + 1
Loop Until Cells(i, 1) = starting_date And Cells(i, 4) = K
pc(j) = Cells(i, 3)
T(j) = Cells(i, 8)
If Cells(i, 1) <> starting_date And Cells(i, 4) = K Then '
Do
i = i + 1
Loop Until Cells(i, 1) = starting_date And Cells(i, 4) = K
pc(j) = Cells(i, 3)
T(j) = Cells(i, 8)
ElseIf Cells(i, 1) = starting_date And Cells(i, 4) = K Then
pc(j) = Cells(i, 3)
T(j) = Cells(i, 8)
End If
'affichage des données extraites
Cells(4 + j, 14) = pc(j)
Cells(4 + j, 16) = starting_date
Cells(4 + j, 17) = T(j)
Cells(4 + j, 18) = K
Cells(4 + j, 20) = starting_date + week_end
Next j
End Sub