Private Sub CommandButton1_Click()
Dim PageDe As Single, PageA As Single, p As Single
Dim sPas As Single, sBorneMin As Single, sBorneMax As Single
Dim celA As String, celB As String, celC As String, celD As String
If TextBox1.Value <> "" And TextBox2.Value <> "" Then
PageDe = TextBox2
PageA = TextBox1 / 5
celA = TextBox3
celB = TextBox4
celC = TextBox5
celD = TextBox6
Unload Me
If CheckBox1.Value = True Then
sBorneMin = PageDe
sBorneMax = PageA + TextBox2 - 1
sPas = 1
Else
sBorneMin = PageA + TextBox2 - 1
sBorneMax = PageDe
sPas = -1
End If
For p = sBorneMin To sBorneMax Step sPas
Range("E10,M10,T10").Value = p
Range(celA).Value = p + 1 * PageA
Range(celB).Value = p + 2 * PageA
Range(celC).Value = p + 3 * PageA
Range(celD).Value = p + 4 * PageA
Worksheets("Feuil4").PrintOut
Next p
Range("E10").Value = 0
End If
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.Value <> vbNullString Then
If CLng(TextBox1.Value) Mod 5 <> 0 Then
MsgBox "Veuillez saisir un multiple de 5", vbCritical + vbOKOnly, "Attention..."
Cancel = True
TextBox1.Value = ""
TextBox1.SetFocus
End If
End If
End Sub
Private Sub TextBox1_Change()
Label4.Caption = 0
If TextBox1.Value <> "" Then Label4.Caption = Label4.Caption + CLng(TextBox1.Value)
If TextBox2.Value <> "" Then Label4.Caption = Label4.Caption + CLng(TextBox2.Value)
Label6.Caption = 0
If TextBox1.Value <> "" Then Label6.Caption = CDbl(TextBox1 / 5)
End Sub
Private Sub TextBox2_Change()
Label4.Caption = -1
If TextBox1.Value <> "" Then Label4.Caption = Label4.Caption + CLng(TextBox1.Value)
If TextBox2.Value <> "" Then Label4.Caption = Label4.Caption + CLng(TextBox2.Value)
End Sub
Private Sub TextBox3_Change()
End Sub
Private Sub TextBox4_Change()
End Sub
Private Sub TextBox5_Change()
End Sub
Private Sub TextBox6_Change()
End Sub