Sub Insereligne()
Dim Vprenom As Range, Plage As Range
Dim DerniereLigne As Long, Ligne As Long
Application.ScreenUpdating = False
DerniereLigne = Cells(300, 7).End(xlUp).Row
Set Plage = Range(Cells(1, 7), Cells(DerniereLigne, 7))
For Each Vprenom In Plage
If Vprenom = "S" Then
Range(Cells(Vprenom.Row, 1), Cells(Vprenom.Row, 9)).Interior.ColorIndex = 6
If Cells(Vprenom.Row - 1, 7).Value = "" Then GoTo Poursuivre 'Pour dire que vous avez déjà ajouté la ligne
Cells(Vprenom.Row, 7).EntireRow.Insert Shift:=xlDown
Cells(Vprenom.Row, 7).EntireRow.Insert Shift:=xlDown
Poursuivre:
End If
If Vprenom <> "" Then
With Range(Cells(Vprenom.Row, 1), Cells(Vprenom.Row, 9)).Borders
.LineStyle = xlContinuous
.Weight = xlThin
End With
End If
Next Vprenom
Dim c As Range, d As Range
Set c = Range("I1").End(xlDown)
Do
Set d = c.End(xlDown)
If d.Row < 10000 Then
Set d = d.Offset(1)
d = c: d.Offset(, -1) = "Nb Heures"
d.Offset(, -1).Resize(, 2).Interior.ColorIndex = 44
c = ""
Set c = d.Offset(1).End(xlDown)
Else
Exit Sub
End If
Loop
End Sub