Using the following vba code
I can get the serial number of the date.Please Login or Register to view this content.
How can I get the time serial number portion of same cell formatted at m/d/yyyy h:mm using vba?
Thanks
Using the following vba code
I can get the serial number of the date.Please Login or Register to view this content.
How can I get the time serial number portion of same cell formatted at m/d/yyyy h:mm using vba?
Thanks
Last edited by jprlimey; 02-13-2020 at 05:06 PM. Reason: Solved
Please Login or Register to view this content.
nigelog,
the solution offered appears not to work
I get a Run-time error 13, Type mismatchPlease Login or Register to view this content.
Attachment 662611
The image above I want to subtract the date time serial number between the green and yellow cells (green - yellow). They are the same date but the time factor is different 11:42 AM for green cell and 10:37 AM for yellow cell. Therefore a 1 hour and 5 minute difference which should translate to a higher serial number for the green cell vs the yellow cell.
In the edit line F2, the date appears as 1/6/2020 11:42:00 AM for the green cell.
Thanks
Since date/time serial numbers in Excel are stored as doubles, how about using CDbl(.cells(i,9)) instead of CLng()?
Originally Posted by shg
MrShorty,
For Date 1/6/2020 10:37:00 AM in Cells(j, 9)
returned (in the Immediate window) 43836Please Login or Register to view this content.
Appears to be missing the time portion should have returned 43836.442136111
Thanks
Dim iTime As Long ---> Double???
I an not able to open your attachment:
Invalid Attachment specified. If you followed a valid link, please notify the administrator
Last edited by protonLeah; 02-13-2020 at 04:04 PM.
Ben Van Johnson
protonLeah,
Your solution worked great.
Thanks very much.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks