1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
| Option Explicit
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub Inserer_bttn_Click()
If TextBox1.Value = vbNullString Then
MsgBox "Vous devez absolument indiquer un PN !", vbExclamation, _
"ERREUR ... Saisissez votre PN !"
TextBox1.SetFocus
Exit Sub
Else
If Not ValiderPN() Then
MsgBox "Votre PN n'est pas valide !", vbExclamation, _
"ERREUR ... PN non valide !"
TextBox1.SetFocus
Exit Sub
End If
End If
If TextBox2.Value = vbNullString Then
MsgBox "Vous devez absolument indiquer un SN !", vbExclamation, _
"ERREUR ... Saisissez votre SN !"
TextBox2.SetFocus
Exit Sub
Else
If Not ValiderSN() Then
MsgBox "Votre SN n'est pas valide !", vbExclamation, _
"ERREUR ... SN non valide !"
TextBox2.SetFocus
Exit Sub
End If
End If
If TextBox3.Value = vbNullString Then
MsgBox "Vous devez absolument indiquer un gisement !", vbExclamation, _
"ERREUR ... Saisissez votre gisement !"
TextBox3.SetFocus
Exit Sub
Else
If Not ValiderGST() Then
MsgBox "Votre GST n'est pas valide !", vbExclamation, _
"ERREUR ... GST non valide !"
TextBox3.SetFocus
Exit Sub
End If
End If
If TextBox4.Value = vbNullString Then
MsgBox "Vous devez absolument indiquer une quantité !", vbExclamation, _
"ERREUR ... Saisissez votre quantité !"
TextBox4.SetFocus
Exit Sub
Else
If Not ValiderQTE() Then
MsgBox "Votre QTE n'est pas valide !", vbExclamation, _
"ERREUR ... QTE non valide !"
TextBox4.SetFocus
Exit Sub
End If
End If
If TextBox5.Value = vbNullString Then
MsgBox "Vous devez absolument indiquer une date !", vbExclamation, _
"ERREUR ... Saisissez une date !"
TextBox5.SetFocus
Exit Sub
Else
If Not ValiderDATE() Then
MsgBox "Votre date est incompréhensible ou mal formatée ! Utilisez le format ...", vbExclamation, _
"ERREUR ... Saisissez une date !"
TextBox5.SetFocus
Exit Sub
End If
End If
EntrerLesDonnes
MsgBox "Votre référence a été correctement ajoutée"
TextBox1.Value = vbNullString
TextBox2.Value = vbNullString
TextBox3.Value = vbNullString
TextBox4.Value = vbNullString
TextBox5.Value = vbNullString
End Sub
Function ValiderPN() As Boolean
' Ajouter le code de validation ici (If .. Then ValiderPN = True)
ValiderPN = True
End Function
Function ValiderSN() As Boolean
' Ajouter le code de validation ici (If .. Then ValiderSN = True)
ValiderSN = True
End Function
Function ValiderGST() As Boolean
' Ajouter le code de validation ici (If .. Then ValiderGST = True)
ValiderGST = True
End Function
Function ValiderQTE() As Boolean
' Ajouter le code de validation ici (If .. Then ValiderQTE = True)
ValiderQTE = True
End Function
Function ValiderDATE() As Boolean
' Ajouter le code de validation ici (If .. Then ValiderDATE = True)
ValiderDATE = True
End Function
Sub EntrerLesDonnes()
Dim c As Range
Set c = Worksheets("Feuil1").Cells(1)
While Not IsEmpty(c.Value)
Set c = c.Offset(1, 0)
Wend
c.Value = TextBox1.Value
c.Offset(0, 1).Value = TextBox2.Value
c.Offset(0, 2).Value = TextBox3.Value
c.Offset(0, 3).Value = TextBox4.Value
c.Offset(0, 4).Value = TextBox5.Value
End Sub |
Partager