Set WS = feuil2
lr = WS.Range("B" & Rows.Count).End(xlUp).row
range("d6:d"&lr")'formula'=IF($B6<>"";TEXT($C6;"DDD");"")
range("C8:C"&lr")'formula'=IF($B8<>"";C6+1;"-")
RANGE E:AM 'formula'
'SOMME.SI.ENS
=SUMIFS(sheet1!$J:$J;sheet1!$B:$B;$B6;sheet1!$A:$A;$C6;sheet1!$D:$D;E$5)
=SUMIFS(sheet1!$J:$J;sheet1!$B:$B;$B6;sheet1!$A:$A;$C6;sheet1!$D:$D;F$5)
=SUMIFS(sheet1!$J:$J;sheet1!$B:$B;$B6;sheet1!$A:$A;$C6;sheet1!$D:$D;G$5)
'Up to the AM column'
=SUMIFS(sheet1!$J:$J;sheet1!$B:$B;$B6;sheet1!$A:$A;$C6;sheet1!$D:$D;AM$5)
RANGE E4:AM4 'formula'
'SOUS.TOTAL
range("E4)formula =SUBTOTAL(109;E6:E"&lr)
column AN formula range("AN6:N"&lr")'formula
=SUM($E6:$AM6)