View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
semiopen semiopen is offline
external usenet poster
 
Posts: 25
Default Here's an Easy One


Kevin wrote:
Forgot to mention. I'm trying to store the result in this variable:

dim myResult as date


Try this:

Sub test()

Dim myVar As Single
Dim myDate As Date
Dim myResult As Date
Dim myMinutes As Long


myVar = 0.96
myMinutes = Round(myVar * 24 * 60) 'myVar times # of minutes in a day
myDate = "9/29/06 12:33"
myResult = DateAdd("n", myMinutes, myDate)
MsgBox myResult

End Sub

-------------------------------------

I don't know if there is a more elegant way

-semiopen