Option Explicit
Dim Z As Long, J As Long, i As Long
Private Sub CommandButton1_Click()
With Sheets("ESSAI")
.[A4:J140].ClearContents
.[A4:J140].Interior.ColorIndex = xlNone
.[A4:J140].Font.Color = vbBlack
.[A4] = TextBox1.Value
.[A4].Font.Color = RGB(192, 0, 0)
.[A4].HorizontalAlignment = xlCenter
Z = 5: J = 1
For i = 6 To 135
If Me("TextBox" & i) <> "" Then
.Cells(Z, 2) = Me("TextBox" & i).Value
Z = Z + 1
.Range(.Cells(4, 1), .Cells(4, 2)).Interior.Color = RGB(239, 239, 239)
End If
If i = 31 Or i = 57 Or i = 83 Or i = 109 Then
J = J + 1
Z = Z + 1: .Cells(Z - 1, 1) = Me("TextBox" & J).Value
End If
If i = 31 Or i = 58 Or i = 85 Or i = 112 Then
.Cells(i, 1).HorizontalAlignment = xlCenter
.Cells(i, 1).Font.Color = RGB(192, 0, 0)
.Range(.Cells(i, 1), .Cells(i, 2)).Interior.Color = RGB(239, 239, 239)
End If
Next i
End With
Userform1.Hide
End Sub