M mudraker Jan 22, 2004 #1 Can someone pleae show me how to convert a decimal number to time in VBA 0.249999999966667 = 6:00:00 Thanks In advance
Can someone pleae show me how to convert a decimal number to time in VBA 0.249999999966667 = 6:00:00 Thanks In advance
M mudraker Jan 22, 2004 #3 Dave Thanks for your reply but that is not what i am after. I have a serial number that I need to convert to time in a vba macro anf then have the macro process more code
Dave Thanks for your reply but that is not what i am after. I have a serial number that I need to convert to time in a vba macro anf then have the macro process more code
R Ron Rosenfeld Jan 22, 2004 #4 Can someone pleae show me how to convert a decimal number to time in VBA 0.249999999966667 = 6:00:00 Thanks In advance --- Click to expand... That value is already equivalent to 6AM because of how Excel stores and displays dates and times. If you do something like: Const dectime As Date = 0.249999999966667 MsgBox ("The time is: " & dectime) The box will display: The time is 6:00:00 AM. Since that's not quite what you specified, you'd need to format it more precisely: MsgBox ("The time is: " & Format(dectime, "h:mm:ss")) In the latter case, dectime can be either a Date or a Double number type. --ron
Can someone pleae show me how to convert a decimal number to time in VBA 0.249999999966667 = 6:00:00 Thanks In advance --- Click to expand... That value is already equivalent to 6AM because of how Excel stores and displays dates and times. If you do something like: Const dectime As Date = 0.249999999966667 MsgBox ("The time is: " & dectime) The box will display: The time is 6:00:00 AM. Since that's not quite what you specified, you'd need to format it more precisely: MsgBox ("The time is: " & Format(dectime, "h:mm:ss")) In the latter case, dectime can be either a Date or a Double number type. --ron
M Max Jan 22, 2004 #6 Maybe CDate() function? x = CDate(0.249999999966667) msgbox x >> gives 6:00:00 AM