View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
E.J. van Wijngaarden[_2_] E.J. van Wijngaarden[_2_] is offline
external usenet poster
 
Posts: 5
Default retriveing old AND new value of a cell in code

Hello experts,

I have an Excel application that uses the Worksheet_Change event to automate
a stock of articles.
So when a new order is placed I read the number of articles that is entered
using Target.Value in Worksheet_Change and substract it from the total
stock.
This works OK for new entered articles.
But when I change the number of articles of an entry that has already be
filled in, it keeps substracting the full amount.
For example: I enter a new order with 14 articles. The number 14 is
substracted from the total stock.
Now I change 14 to 24. Then the number 24 is substracted from the total
stock.
Now the stock is incorrect!

I want to be able to substract the difference between the old and new value:
24-14=10.
BUT: I see no way to read the old value of the cell.
In Worksheet_Change using Target.Vale I see only the 24, because it shows
the new value.
There does not seem to be an event that makes it possible to read the value
BEFORE the change.

How can I solve this?

Thanks for your answer!

Ed van Wijngaarden