Date Format

Zzyzzyth

Board Regular
Joined
Feb 19, 2002
Messages
145
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.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
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!
 
Upvote 0
That is code.

Sub GetNumericDate()
Dim lngDateVal As Long

lngDateVal = CLng(Range("A1"))

End Sub

Regards,
D
 
Upvote 0
Crap. I'm sorry DK, I totally read that wrong. I thought you had InputBox there, my bad, that format worked great. Thank you.
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,957
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top