Private Sub CmbValiderretrait_Click()
ActiveSheet.Unprotect
Dim L As Long, x As Long
L = ComboRef.ListIndex + 2
If TextQuantité1 = "" Then
MsgBox " Vouse devez définir une quantité"
Exit Sub
End If
If IsNumeric(TextQuantité1) = False Then
MsgBox " Vous devez définir une quantité numérique"
Exit Sub
End If
With Sheets("Stock")
x = .Cells(L, 4) - CLng(TextQuantité1.Value)
If x < 0 Then
MsgBox "La quantité n'est pas disponible"
TextQuantité1 = ""
TextQuantité1.SetFocus
Exit Sub
End If
End With
With Sheets("Stock")
[COLOR="Red"]Sheets("Stock").unprotect[/COLOR]
.Cells(ComboRef.ListIndex + 2, 4) = .Cells(ComboRef.ListIndex + 2, 4) - CLng(TextQuantité1.Value)
If .Cells(ComboRef.ListIndex + 2, 13) >= .Cells(ComboRef.ListIndex + 2, 4) Then
UserForm2.Show
End If
End With
Unload Me
[COLOR="Red"]Sheets("Stock").Protect DrawingObjects:=True, Contents:=True, Scenarios:=True[/COLOR]
End Sub