ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   undo date format questions (https://www.excelbanter.com/excel-programming/349613-undo-date-format-questions.html)

Ram

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




All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com