edster001
09-11-2003, 06:30 AM
I would like to know if it is possible to convert time to Single. In Excel you can set a cell format to [h]:mm for times over 24hr's. and in another cell you set the format to generall and it will convert the time to Single. For example 39:30 gives a result of 1.645833333. Now in vb i can convert 1.645833333 back to 39:30 but not from 39:30 to 1.645833333. Here is some sample code that can convert the single to time format.(I cant get it to give me 39:30, instead it gives me 15:30, I have tried the [h]:mm format but vb does not recognise it)
Private Sub Command1_Click()
Text2.Text = Format(Text1.Text, "hh:mm")
End Sub
Private Sub Command1_Click()
Text2.Text = Format(Text1.Text, "hh:mm")
End Sub