Sub Formules()
'On génére les formules de la BDD
With Sheets("COMPTES")
'Choix du format des dates de la colonne B
.Range("B2:B" & .Cells(Rows.Count, 1).End(xlUp).Row).NumberFormat = _
"dd/mm/yyyy"
'Transformation des Dates en Année
.Range("C2:C" & .Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
"=YEAR(RC2)"
'Fomat texte de l'Année
.Range("C2:C" & .Cells(Rows.Count, 1).End(xlUp).Row).NumberFormat = _
"General"
'Découpage de POSTE
.Range("H2:H" & .Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
"=IF(RC7="""","""",LEFT(RC7,SEARCH("" - "",RC7)-1))"
'Découpage de POSTE
.Range("I2:I" & .Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
"=IF(RC7="""","""",IF(ISERROR(SEARCH("" - "",RC7,SEARCH("" - "",RC7)+1)),RIGHT(RC7,LEN(RC7)-SEARCH("" - "",RC7)-2),RIGHT(RC7,LEN(RC7)-SEARCH("" - "",RC7,SEARCH("" - "",RC7)+1)-2)))"
'Recherche de la ligne Analytique
.Range("M2:M" & .Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
"=VLOOKUP(RC[-6],Tb_P_VlookCGPostes,2,0)"
'Détermine si écriture est dans le futur ou non
.Range("N2:N" & .Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
"=IF(RC2>R1C23,""OUI"",""NON"")"
'Calcul du Crédit - Débit
.Range("R2:R" & .Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
"=RC[-1]-RC[-2]"
'Calcul le restant sur Budget Courant
.Range("S2:S" & .Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = _
"=IF(AND(RC[-13]=""COURANT"",RC[-5]=""OUI"",RC[-4]=""NON""),RC[-1],0)"
' "=IF(AND(RC[-13]=""COURANT"",RC[-5]=""OUI""),RC[-1],0)"
End With