ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   View previous cell value programmically (https://www.excelbanter.com/excel-programming/311216-view-previous-cell-value-programmically.html)

strataguru[_17_]

View previous cell value programmically
 

Thanks for the reply.

I'm curious - how does Excel 'undo' cell values then?

Thanks

--
stratagur
-----------------------------------------------------------------------
strataguru's Profile: http://www.excelforum.com/member.php...nfo&userid=131
View this thread: http://www.excelforum.com/showthread.php?threadid=26291


No Name

View previous cell value programmically
 
hi again,
ctrl+x is all i know. i never had a reason to do it
programaticly so i never looked into it. interesting
thought though.

-----Original Message-----

Thanks for the reply.

I'm curious - how does Excel 'undo' cell values then?

Thanks!


--
strataguru
----------------------------------------------------------

--------------
strataguru's Profile:

http://www.excelforum.com/member.php?
action=getinfo&userid=1313
View this thread:

http://www.excelforum.com/showthread...hreadid=262910

.


Tom Ogilvy

View previous cell value programmically
 
Like this

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim v as Variant
Dim vOld as Variant
if target.count 1 then exit sub
if Target.Column = 6 then
v = Target.Value
On Error goto ErrHandler
Application.EnableEvents = False
application.Undo
vOld = Target.Value
Target.Value = v
msgbox "New: " & v & vbNewline & _
"Old: " & vOld
End If
ErrHandler:
Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy

"strataguru" wrote in message
...

Thanks for the reply.

I'm curious - how does Excel 'undo' cell values then?

Thanks!


--
strataguru
------------------------------------------------------------------------
strataguru's Profile:

http://www.excelforum.com/member.php...fo&userid=1313
View this thread: http://www.excelforum.com/showthread...hreadid=262910





All times are GMT +1. The time now is 12:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com