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
| Sub Formules()
Dim l%
Dim z%
'On génére les formules de la BDD
If Not InitFait Then Initialisation
With shC
l = .[a65000].End(xlUp).Row
'Choix du format des dates de la colonne B
'.Range("B2:B" & l).NumberFormat = "dd/mm/yyyy"
'Transformation des Dates en Année
.Range("C2:C" & l).FormulaR1C1 = "=YEAR(RC2)"
'Fomat texte de l'Année
.Range("C2:C" & l).NumberFormat = "General"
'Découpage de POSTE
.Range("H2:H" & l).FormulaR1C1 = "=IF(RC7="""","""",LEFT(RC7,SEARCH("" - "",RC7)-1))"
'Découpage de POSTE
.Range("I2:I" & l).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" & l).FormulaR1C1 = "=VLOOKUP(RC[-6],Tb_P_VlookCGPostes,2,0)"
'Détermine si écriture est dans le futur ou non
.Range("N2:N" & l).FormulaR1C1 = "=IF(RC2>R1C23,""OUI"",""NON"")"
'Calcul du Crédit - Débit
.Range("R2:R" & l).FormulaR1C1 = "=RC[-1]-RC[-2]"
'Calcul le restant sur Budget Courant
'.Range("S2:S" & l).FormulaR1C1 = "=IF(AND(RC[-14]=""REEL"",RC[-13]=""COURANT"",RC[-5]=""OUI"",RC[-4]=""NON""),RC[-1],0)"
End With
End Sub |
Partager