Function generer_date_mfees(date_fin, inv, statut_inv)
Dim aa As Integer
Dim mm As Integer
Dim jj As Integer
Dim nb_ligne_mfees As Integer
Dim cpt As Integer
Dim date_debut As Date
Dim Libelle_MF As String
date_debut = Sheets("Portfolio Forecast").Cells(9, 8).Value
cpt = 0
aa = Right(date_debut, 4)
mm = Mid(date_debut, 4, 2)
jj = Left(date_debut, 2)
Param_Frequence = Sheets("paramétrages").Cells(3, 2).Value
Param_Periode_Payable = Sheets("paramétrages").Cells(3, 3).Value
Do While date_debut < date_fin
If Param_Frequence = "T - Trimestrielle" And Param_Periode_Payable = "D - Début" Then
jj = 5
If mm <= 3 Then
mm = 1
Date_mfees = jj & "/" & mm & "/" & aa
ElseIf mm > 3 And mm <= 6 Then
mm = 4
Date_mfees = jj & "/" & mm & "/" & aa
ElseIf mm > 6 And mm <= 9 Then
mm = 7
Date_mfees = jj & "/" & mm & "/" & aa
ElseIf mm > 9 And mm <= 12 Then
mm = 10
Date_mfees = jj & "/" & mm & "/" & aa
End If
End If
' pour test : montant = 1234
Libelle_MF = "MF - 0" & mm & "/" & aa & " - taux : 1% "
ReDim Preserve tabForecast(1, 1, 1, 1, cpt_tableau_forecast) ' attention, la clé doit etre en dernier pour rendre le tableau dynamique
tabForecast(0, 0, 0, 0, cpt_tableau_forecast) = Array(Libelle_MF, Date_mfees, 1234, statut_inv, inv)
cpt_tableau_forecast = cpt_tableau_forecast + 1
Loop
end function