change date cell automatically if number in inventory is decreasing

EMORIN

New Member
Joined
Jun 16, 2017
Messages
8
Im new with excel and i was wondering if there is a way to make the date change automatically for today's date if i decreased the number of item in my inventory.
 
this working well but i dont want my date to changed if i increased the number in D.
Now the date change everytime i changed the quantity
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Yes I'm sorry I did not read your question closely. I'm not sure how to do what your wanting. My script is designed to work when any change is made.

Maybe someone else here at Mr. Excel will have an answer for you.
I will continue to monitor this thread
 
Upvote 0
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
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,239
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top