PDA

View Full Version : [SOLVED] Retrieving old Target Value



malik641
09-17-2005, 10:42 AM
Is is possible to display a target's old value after you have changed the Target value???

Here is an example of displaying the new value:


Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim R As Range
Dim RVal As Long
For Each R In Target
RVal = R.Value
MsgBox "New value is: " & RVal
Next
End Sub

How could I make this so that it would display the old value???

malik641
09-17-2005, 11:39 AM
Nevermind, I got it.


Private OldValue As Variant

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
OldValue = Target.Cells(1, 1).Value
End Sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
MsgBox "Old value was: " & OldValue
End Sub

Thanks to Jindon at MrExcel.com :thumb
Thanks for reading.