Here's one way:-
MsgBox CLng(Range("A1").Value)
Regards,
D
When reading in a date value from a cell with the format of mm/dd/yy, how do I convert this to the integer value in code. For example: read in 02/25/02 and have my variable show 37312. I know it's not tough, I just can't seem to find any of my old snippets with the Format code.
As always, thank you for your help.
The date is pre-determined in a closed workbook, I don't need the user screwing it up (if you know what I mean!). I know there is a way through code to format, I just can't find it. Needs to be through code!
That is code.
Sub GetNumericDate()
Dim lngDateVal As Long
lngDateVal = CLng(Range("A1"))
End Sub
Regards,
D
Crap. I'm sorry DK, I totally read that wrong. I thought you had InputBox there, my bad, that format worked great. Thank you.
Like this thread? Share it with others