undo date format questions  
Author Message
peto





PostPosted: Top

Excel Programming >> undo date format questions

I use the following code to change the cell contents back to the previous
value. When I change a cell with a date value the code places 1/1/1900 in
it's place, instead of the actual date. Can someone explain how I can have
the correct date valued entered.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim OldValue As Variant
OldValue = Target(1).Formula
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
Dim OldValue As Variant
If Target(1).Formula <> OldValue Then _
MsgBox "Used to be " & CStr(OldValue)
End Sub



Thanks for any help

Excel148