PDA

View Full Version : Solved: Numeric Time Values in VBA - Reference?



NateW
01-16-2008, 09:46 AM
Hi, Folks.

I'm looking for a way to get a listing of various time values for use in vba time calculations - I'm not sure what the proper name of this is, but it's the numeric value that is stored for dates and times - where each calendar day starting from 1899 or something has a whole number value, and the hours and minutes, etc, have a decimal value.

Does anyone know if there is a reference anywhere that will show various values? Or, alternately, is there a way in excel to display the time values with code, to create a reference list of my own?

Thanks in advance for any help - please let me know if you need any further clarification.

Cheers!
Nate. :hi:

unmarkedhelicopter
01-16-2008, 11:44 AM
I'm not sure what you mean but if you want the dates then set A1 to 1 and B1 to = A1 and format B1 as date and just drag down, there is an error as 1900/02/29 should not exist but apart from that ...
if you want an extra day just add 1
if you want an extra hour just add 1/24
if you want an extra minute just add 1/24/60
if you want an extra second just add 1/24/60/60
though you should be careful as VBA has arounding error on 'some' times which means you can be anywhere up to a second out, not many people are that picky, but you should be aware.

NateW
01-16-2008, 02:46 PM
Thanks very much!