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
| Option Explicit
Dim Total,Poids,OA,Quantite,newpoids
Private Sub Total_Enter()
Dim Quantite,newpoids
If OA = "" Then
MsgBox ("L'OA n'est pas renseigné")
Exit Sub
Else
Quantite = InputBox("Combien de pièces ?")
If Quantite = "" Then
MsgBox ("Vous devez indiquer la Quantité")
Exit Sub
End if
If IsNumeric(Quantite) then
newpoids = InputBox("Quel poids ?")
If newpoids = "" Then
MsgBox ("Vous devez indiquer le poids")
Exit Sub
End If
If IsNumeric(newpoids) then
Total = Quantite * newpoids
Poids = newpoids
Else
MsgBox ("Pour le poids, vous devez entrer un chiffre")
Exit Sub
End If
Else
MsgBox ("Pour la quantité, vous devez entrer un chiffre")
Exit Sub
End if
End If
End Sub
OA = 1
Total_Enter
Msgbox "total: " & Total & VbNewLine & "Poids: " & Poids |