i found that one of my collegue was studying in programming here is what we do we put some variable and change the private worsheet for selection change
we also add a new column so (d) is the initial value in stock, (E) is the number by wich we want to change the value and (F) is the date.
PV= previous value
NV= new value
QTY= the number of item we put in stock or we want to withdraw
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Definition of Variable
Dim QTY As Integer, PV As Integer, NV As Integer, NBVAL As Integer, STRNB As Integer
'STRNN : Start number = 2 : Title = 2
STRNB = 3
'Line number with Title + 1 (Title = A1)
NBVAL = Application.WorksheetFunction.CountA(Range("B:B")) + 1
'FOR LOOP FOR ALL CELLS
For CT = STRNB To NBVAL
'Variables affectations
QTY = Cells.Item(CT, "E")
PV = Cells.Item(CT, "D")
NV = PV + QTY
'Conditions
If PV = 0 Or Cells(CT, "D").Value = "" Then Cells(CT, "F").Value = Date
If NV < 0 Then NV = 0
If NV < PV Then Cells(CT, "F").Value = Date
'Cells actions
Cells(CT, "D").Value = NV
Cells(CT, "E").ClearContents
Next CT
Exit Sub
End Sub