Sub Macro_formules()
'
' Macro_formules Macro
'
'
Sheets("Feuil1").Activate
Range("A5, B5, C5, D5, P5, R5, AE5, AG5").ClearContents
Range("A5").FormulaR1C1 = "=IF([@CommandeNum]<>"""",CONCATENATE([@CommandeNum],[@NumLigne],[@NumSousLigne]),"""")"
Range("A5").AutoFill Destination:=Range("Tableau2[N°]")
Range("B5").FormulaR1C1 = "=CONCATENATE([@CommandeNum],""-"",[@NumLigne],""-"",[@NumSousLigne])"
Range("B5").AutoFill Destination:=Range("Tableau2[CommandeLigne]")
Range("C5").FormulaR1C1 = "=VLOOKUP([@NomFrs],Fournisseurs,3,FALSE)"
Range("C5").AutoFill Destination:=Range("Tableau2[Dhaka office]")
Range("D5").FormulaR1C1 = "=IF([@CommandeNum]="""","""",VLOOKUP([@NomFrs],Fournisseurs,2,FALSE))"
Range("D5").AutoFill Destination:=Range("Tableau2[Gestionnaire]")
Range("P5").FormulaR1C1 = "=IF([@[ETD manuel]]="""","""",[@[ETD manuel]]-[@[DateExpPrevue (M3)]])"
Range("P5").AutoFill Destination:=Range("Tableau2[Délai]")
Range("R5").FormulaR1C1 = "=IF([@Partiel]="""","""",[@QteCommandéeOrigine]-[@Partiel])"
Range("R5").AutoFill Destination:=Range("Tableau2[Reliquat]")
Range("AE5").FormulaR1C1 = "=IF([@CommandeNum]="""","""",IF([@ETA]<>"""",[@ETA]+15,IF([@[ETD manuel]]<>"""",[@[ETD manuel]]+45,[@[DateExpPrevue (M3)]]+45)))"
Range("AE5").AutoFill Destination:=Range("Tableau2[Dépôt]")
Range("AG5").FormulaR1C1 = "=IF(ISERROR(VLOOKUP([@NomFrs],Fournisseurs,4,FALSE)),"""",VLOOKUP([@NomFrs],Fournisseurs,4,FALSE))"
Range("AG5").AutoFill Destination:=Range("Tableau2[MAJ]")
End Sub