Dim lig As Variant 'mémorisation
Private Sub CBPiece_Change()
Reference = ""
Stock = ""
With Sheets("MECANIQUE")
lig = Application.Match(CBPiece, .[B:B], 0)
If IsNumeric(lig) Then
Reference = .Cells(lig, "C")
Stock = .Cells(lig, "D")
End If
End With
End Sub
Private Sub CommandButton1_Click()
Dim stoc As Range
If Val(Stock) Then
Set stoc = Sheets("MECANIQUE").Cells(lig, "D")
stoc = stoc - Val(MvtStock)
Stock = stoc
MvtStock = ""
End If
End Sub
Private Sub SpinButton1_Change()
MvtStock = SpinButton1
End Sub