salut j'ai reussi a faire ce que je voulais donc voici la macro , merci pour votre aide
Sub Macro2()
Dim i, j As Integer
Dim numligne As Integer
If IsDate(Range("D2")) = True Then
i = 2
While IsEmpty(Range("sheet1!A" & i)) = False
numligne = Range("sheet1!J" & i).Value
j = i
Range("K" & i).Formula = "=IF(RC[-7]="""","""",DATEDIF(RC[-7],TODAY(),""d""))"
For i = j + 1 To j + numligne - 1
Rows(j & ":" & j).Select
Application.CutCopyMode = False
Selection.Copy
Rows(i & ":" & i).Select
Selection.Insert Shift:=xlDown
Range("K" & i).Formula = "=IF(RC[-7]="""","""",DATEDIF(RC[-7],TODAY(),""d""))"
Next i
Wend
Else
i = 3
While IsEmpty(Range("sheet1!A" & i)) = False
numligne = Range("sheet1!k" & i).Value
j = i
Range("L" & i).Formula = "=IF(RC[-7]="""","""",DATEDIF(RC[-7],TODAY(),""d""))"
For i = j + 1 To j + numligne - 1
Rows(j & ":" & j).Select
Application.CutCopyMode = False
Selection.Copy
Rows(i & ":" & i).Select
Selection.Insert Shift:=xlDown
Range("l" & i).Formula = "=IF(RC[-7]="""","""",DATEDIF(RC[-7],TODAY(),""d""))"
Next i
Wend
End If
End Sub