View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default 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