Capture Excel cell change without SelectionChange event?

Hello, I am trying to capture the change (difference) of a cell value before and after a change is made. When a user manually changes one cell at a time I have been using the Worksheet_SelectionChange to capture the cells initial value to track the changes but these values can also be updated by a macro that does not select the cell before making the changes.

Is there any way to track these changes without having my code select each cell to be changed first?
LVL 1
wipnavAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rory ArchibaldCommented:
You should be using the Worksheet_Change event, not the SelectionChange event. :)
0
wipnavAuthor Commented:
I am, sorry for the confusion.

My procedure adds a comment the cell being changed that is supposed to report the difference in the values (new value - previous value). This code is embedded in the Worksheet_Change event. I was using the Worksheet_SelectionChange event to get the previous value.

My question is how do I get the previous value without using the Worksheet_SelectionChange event?
0
Rory ArchibaldCommented:
I don't really understand what the SelectionChange event has to do with anything.
The usual way to test against the previous value in a change event is to store the value of the cell in a variable, use Application.Undo to revert to the previous value, and then test against the stored value. If your changes are the result of code, I suspect that won't work unless the changing code provides its own Undo routine.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
wipnavAuthor Commented:
Hmm, undo does sound like a better solution. This all started out just tracking changes on one cell manually and setting a variable to the value of the cell in the SelectionChange event to be used in comparing to the Change event worked fine, but for what I need to do now, using undo would be better.

I will use that for when the changes are made manually and just set a global variable from my other procedures that change the cell values before I make the changes then pass them to the Worksheet_Change event.

Thanks for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.