FranktheBank
Member
Hello again,
I'm trying to use the DTPicker Control to return a time to a cell. I thought it would be more or less the same commands as using the MonthView control, but it does not return the time (it makes sense as you don't 'click' a time nor is there an 'O.K.' button on DTPicker).
I basically put the DTPicker Control on my Userform and changed the Format to 1 - dtpTime
As always, any and all help is appreciated.
My Code so far:
I'm trying to use the DTPicker Control to return a time to a cell. I thought it would be more or less the same commands as using the MonthView control, but it does not return the time (it makes sense as you don't 'click' a time nor is there an 'O.K.' button on DTPicker).
I basically put the DTPicker Control on my Userform and changed the Format to 1 - dtpTime
As always, any and all help is appreciated.
My Code so far:
Code:
Private Sub CommandButton1_Click()
Unload Me
End Sub
Sub OpenTime()
Time.Show
End Sub
Private Sub DTPicker1_Initialize()
DTPicker1.Value = Hour ' Show today's date on initialize
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
On Error Resume Next
Dim Cell As Object
For Each Cell In Selection.Cells
Cell.Value = DTPicker1Clicked
Next Cell
Unload Me
End Sub
Private Sub UserForm_Initialize()
If IsDate(ActiveCell.Value) Then
DTPicker1.Value = ActiveCell.Value
Else
DTPicker1.Value = Now
End If
End Sub
[Code]