Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default View previous cell value programmically


I have a vba macro that is kicked off from ThisWorkbook whe
Workbook_SheetChange event occurs.

When the user inputs or updates a value in a cell - I'd like to kno
the previous value. What object will provide me with tha
information?

Thanks!
-Robi

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default View previous cell value programmically

hi,
i dont' think you can. once changed and you aint' there to
see it...it's gone. you could write code that copies all
NEW entries to a history sheet/file with control name, new
value, date, time, ect. you could then search past data to
find it.

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

I have a vba macro that is kicked off from ThisWorkbook

when
Workbook_SheetChange event occurs.

When the user inputs or updates a value in a cell - I'd

like to know
the previous value. What object will provide me with that
information?

Thanks!
-Robin


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

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

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

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

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default View previous cell value programmically

Robin,

Use this in the change event:

Dim NewVal As Variant
Dim OldVal As Variant

If Target.Cells.Count < 1 Then Exit Sub

NewVal = Target.Value
With Application
.EnableEvents = False
.Undo
OldVal = Target.Value
.Undo
.EnableEvents = True
End With
MsgBox "The old value was " & OldVal & Chr(10) & _
"The new value is " & NewVal

HTH,
Bernie
MS Excel MVP

"strataguru" wrote in message
...

I have a vba macro that is kicked off from ThisWorkbook when
Workbook_SheetChange event occurs.

When the user inputs or updates a value in a cell - I'd like to know
the previous value. What object will provide me with that
information?

Thanks!
-Robin


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

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
3-Color Scale Vlookup for Current Month/Previous/Pre-Previous NeoFax Excel Discussion (Misc queries) 2 January 8th 10 07:04 PM
How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell [email protected] Excel Worksheet Functions 2 November 7th 07 09:39 AM
Creating Variables Programmically Brite Excel Discussion (Misc queries) 5 April 23rd 07 10:34 AM
Edit Data Query Programmically? Squid[_2_] Excel Programming 5 May 27th 04 10:13 PM
How do I change a function's otional parameter default values programmically Michael[_21_] Excel Programming 5 October 24th 03 09:22 PM


All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"