Sub Insertion()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
With [A1].CurrentRegion
If .Columns.Count = 44 Then Union(.Columns(9), .Columns(13).Resize(, 6)).EntireColumn.Delete 'RAZ
'---insertions---
.Columns(9).EntireColumn.Insert
.Columns(13).Resize(, 6).EntireColumn.Insert
'---en-têtes---
.Cells(1, 9) = "Jour"
.Cells(1, 13).Resize(, 6) = Array("Heures jour", "Heures de nuit", "Nb HS Jour", "Nb HS Nuit", "Nb HS dimanche et JF", "TOTAL HS MISSION")
If .Rows.Count = 1 Then Exit Sub
'---formules---
.Cells(2, 9).Resize(.Rows.Count - 1) = "=TEXT(H2,""jjj"")"
.Cells(2, 13).Resize(.Rows.Count - 1) = "=MOD(L2-J2,1)-N2"
.Cells(2, 14).Resize(.Rows.Count - 1) = "=(MAX(0,MIN(IF(L2<J2,1,0)+L2,1+'\\dfs01.ch-melun.fr\Racine01\DRH\Commun\THEO\[HS JR NUIT.xlsx]Feuil1'!$B$2)-MAX(J2,'\\dfs01.ch-melun.fr\Racine01\DRH\Commun\THEO\[HS JR NUIT.xlsx]Feuil1'!$B$1)))"
.Cells(2, 15).Resize(.Rows.Count - 1) = "=IF(M2='\\dfs01.ch-melun.fr\Racine01\DRH\Commun\THEO\[HS JR NUIT.xlsx]Feuil1'!$A$3,0,IF(M2>'\\dfs01.ch-melun.fr\Racine01\DRH\Commun\THEO\[HS JR NUIT.xlsx]Feuil1'!$A$3,M2,0))-Q2"
.Cells(2, 16).Resize(.Rows.Count - 1) = "=IF(N2='\\dfs01.ch-melun.fr\Racine01\DRH\Commun\THEO\[HS JR NUIT.xlsx]Feuil1'!$A$3,0,IF(N2>'\\dfs01.ch-melun.fr\Racine01\DRH\Commun\THEO\[HS JR NUIT.xlsx]Feuil1'!$A$3,N2,0))"
.Cells(2, 17).Resize(.Rows.Count - 1) = "=IF(I2=""dim"",M2,0)"
.Cells(2, 18).Resize(.Rows.Count - 1) = "=SUM(O2:Q2)"
End With
End Sub