Digitborn.com
Active Member
- Joined
- Apr 3, 2007
- Messages
- 353
Hello,
How can I retrieve from UserForm DTPicker1 to a Cell only the time value?
I tried:
I really couldn't make it by myself, trying to read all kind of topics about DTPicker1 Format
The result is or:
12:00:00 AM - returns the defaul value in the cell
7/20/2007 11:44 - returns the date + the correct time filled in the UserForm
I'd like to return in the cell only the "h:mm".
Thanks in advance
How can I retrieve from UserForm DTPicker1 to a Cell only the time value?
I tried:
Code:
Private Sub CommandButton5P1_Click()
Dim MyDate1 As Date
MyDate1 = DTPicker1.Value
DTPicker1.Format = dtpTime
DTPicker1.Value = Format(Time, "Short Time")
'or
DTPicker1.Value = Format(MyDate1, "h:mm")
ws.Cells(lRow, 13).Value = MyDate1
'or
ws.Cells(lRow, 13).Value = DTPicker1.Value
End Sub
The result is or:
12:00:00 AM - returns the defaul value in the cell
7/20/2007 11:44 - returns the date + the correct time filled in the UserForm
I'd like to return in the cell only the "h:mm".
Thanks in advance