I have written this code to convert timestamp to date. But when the timestamp value is 2613441599, it throws an overflow error. Any idea as to what the root of the problem is? Thanks in advance
Sub Update_Date()
Dim d_date As Double
Dim x As Long
Dim y As Long
Dim Userlastcol As Long
Dim Userlastrow As Long
Dim sheeta As Worksheet
Set sheeta = ThisWorkbook.Worksheets("UserData")
Userlastrow = sheeta.Range("A" & Rows.Count).End(xlUp).Row
Userlastcol = sheeta.Cells(1, Columns.Count).End(xlToLeft).Column
For x = 1 to Userlastcol
If sheeta.Cells(1,x).Value = "UpdatedAt" Then
For y=2 to Userlastrow
if sheeta.Cells(y,x).Value = 0 Then
sheeta.Cells(y,x).Value = ""
else
d_date = sheeta.Cells(y,x).Value '//fetch timestamp value and store in d_date of data type double
sheeta.Cells(y,x).Value = DateAdd("s", d_date, "1/1/1970 00:00:00") '//throws overflow error
End If
Next y
End If
Next x