Sub Calcul()
Dim Lbarre, P As Range, nlig&, lig&, nbarre&, c As Range, i&
Lbarre = 6000
Set P = [A1].CurrentRegion
nlig = P.Rows.Count
Application.ScreenUpdating = False
P.Offset(1, 1).ClearContents
P.Offset(1, 1).Interior.ColorIndex = xlNone
lig = 2
1 If P(lig, 1) > Lbarre Then P(lig, 1).Select: MsgBox "Découpe erronée !", 48: Exit Sub
nbarre = nbarre + 1
P(lig, 2) = nbarre
P(lig, 3) = Lbarre '1ère barre
Set c = P(lig, 4)
c = Lbarre - P(lig, 1)
For i = lig + 1 To nlig
If P(i, 1) < c And P(i, 2) = "" Then
P(i, 2) = nbarre
P(i, 4) = c - P(i, 1)
Set c = P(i, 4)
End If
Next i
c.Interior.ColorIndex = 6 'jaune
For i = lig + 1 To nlig
If P(i, 2) = "" Then
lig = i...