Worksheet Change, Get previous cell value

JC2710

Board Regular
Joined
Mar 10, 2008
Messages
164
Hi

I have a drop down validation cell on an excel sheet and some code on the worksheet change event.

If the user selects from the drop down I want to check the new value and then be able to change it back to the previous value?

The target is the new value. How do I get the previous value of the cell?

Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
You can grab the current value, turn events off, use Application.Undo to revert to the previous value, check it, reset the current value if applicable, then turn events back on.
 
Upvote 0
Thanks For your help guys.

I think I can get what I want by using the Undo event as suggested by rorya.

I just check the current value and if its not valid then I just do Application.Undo to get back to the previous value.

Thanks again!
 
Upvote 0
As a matter of interest, why would it not be valid when it's supplied by data validation?
 
Upvote 0
The validity of what the user can select from the drop down is determined by the sum of a column on the spreadsheet.

So for example if the user selects "Use Sheets" from the dropdown, if the sum of the "Use Qty" column on the spreadsheet is greater than 0, I want to stop the user selecting "Use Sheets", as they are already using "Qty".

I hope that makes sense.
 
Upvote 0
One more question about JC2710's problem.

For example, we did undo. Then if we want to get the last thing back, what do we need to do? Is there any function which can reverse "undo"?
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,024
Members
448,543
Latest member
MartinLarkin

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