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
| Private Sub Txt_Nbre_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim c As Range
Dim Q As Double
If Me.Cmb_NumArt.ListIndex > -1 Then
Q = Val(Replace(Me.Txt_Nbre, ",", "."))
If Q > 0 Then
With Worksheets("Feuil1") 'A adapter
Set c = .Range("B:B").Find(Me.Cmb_NumArt.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing Then
If c.Offset(, 6).Value < Q Then
Cancel = True
Me.Txt_Nbre = ""
MsgBox "Vous dépassez le stock disponible"
End If
Set c = Nothing
End If
End With
Else
MsgBox "Veuillez saisir la quantité"
End If
Else
MsgBox "Veuillez saisir l'article"
End If
End Sub |