rheeyeonsang,
Macro in attached sample runs when you change any value cell (example assumes you put the value in Col D).
It "undoes" the new price, copies and stores the old value, then reinstates the New Value.
If the Old value and the New one are different, it pastes the "old" value into Col F of that row.
If you change the Col D price again, the first change then becomes the "old" price in Col F, and so on.
Option Explicit
Dim f As Long, OldValue As Long
Dim rng1 As Range
'Dim OldValue As Variant
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Set rng1 = Intersect(Target, Range("D2:D5"))
If Target.Cells.Count > 1 Then Exit Sub
If rng1 Is Nothing Then Exit Sub
Application.EnableEvents = False
Application.Undo
OldValue = Target.Value
Application.Undo
Application.EnableEvents = True
If OldValue <> Target.Value Then
Target.Offset(0, 2) = OldValue
End If
ErrorHandler:
Resume Next
Application.EnableEvents = True
End Sub
Hope this helps
Ochimus
Bookmarks