display time in the textbox of a user form


Posted by simon on January 14, 2002 5:46 PM

I have a userform to display time in the textbox. For example

Sub ShowStaffRecord()

With ufStaff
.tbxTimestart = ActiveCell.Offset(0, 13)
'the value in this cell is 8:15:00
.tbxTimeend = ActiveCell.Offset(0, 14)
End with
End Sub


The textbox in the form can only displace 0.34375 not 8:15:00
I have tried .tbxTimestart = time(ActiveCell.Offset(0, 13))
or
.tbxTimestart = timevalue(ActiveCell.Offset(0, 13))
It still does not work.

Thanks for any help :)



Posted by Jacob on January 14, 2002 7:40 PM

Hi

This should do the trick

Textbox1.value = Application.WorksheetFunction.Text(ActiveCell.Offset(0, 13).Value, "H:MM:SS")


HTH

Jacob