• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Return Time to Cell using DTPicker

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:
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]
 
Here's a Screenshot (Capture.JPG) of what's working so far. What I'd like the DTPicker to do is if I'm in Cell I2, return the time 8:18:11 AM
 

Attachments

  • Copy of bf tracking 2017v2_2.xlsb
    165.4 KB · Views: 3
  • Capture.JPG
    Capture.JPG
    115.4 KB · Views: 6
Back
Top