olorin_117
New Member
- Joined
- Jan 19, 2022
- Messages
- 18
- Office Version
- 2019
- Platform
- Windows
I have run to this weird problem and I really can't understand what is happening.
I have the code below
It compares the user input with the date that MUST be in a textbox...Until yesterday it worked PERFECT with no problems at all
Today that I continued my work on the excel project If I Debug.Print the expdate varieable the date that it shows is 30/06/1901 !!!!!!
PS. If I Debug.Print Now it shows the correct date
PS.2. I am using Excel 2019 but I tried the workbook on a different laptop with Excel 2016 and shows the same thing. (The second try is because I changed my RAM yesterday -every time in my system is correct - and thought I messed up something)
I have the code below
VBA Code:
Dim tddate As Date
Dim expdate As String
Dim inputdate As String
tddate = Worksheets("Sheet3").Range("pdate").Value
inputdate = TextBox1.Value
expdate = Format(DateAdd("m", 18, tddate), "dd/mm/yyyy")
If inputdate = expdate Then
Range("A1").Value = TextBox1.Value
Else
MsgBox "Input the correct date"
Cancel = True
End If
It compares the user input with the date that MUST be in a textbox...Until yesterday it worked PERFECT with no problems at all
Today that I continued my work on the excel project If I Debug.Print the expdate varieable the date that it shows is 30/06/1901 !!!!!!
PS. If I Debug.Print Now it shows the correct date
PS.2. I am using Excel 2019 but I tried the workbook on a different laptop with Excel 2016 and shows the same thing. (The second try is because I changed my RAM yesterday -every time in my system is correct - and thought I messed up something)