Mitchelson
05-16-2008, 10:14 AM
Hi All,
Please find attached a workbook with a UserForm I've created to pick the time and date.
8739
The code behide the UserForm as follows.
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
ActiveCell.ClearContents
Unload Me
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
DTPicker1.Value = Date
End Sub
Private Sub Insert_Click()
If DTPicker1 <> "Select Desired Date" Then
ActiveCell.Value = DTPicker1.value & " " & LDTime1.TimeString
End If
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
This the code used to open the UserForm.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("C6:F13")) Is Nothing Then
Cancel = True
Datetime1.Show
End If
End Sub
I've have a number of issues as listed below on how I would like the UserForm to run but do not have the VBA knowledge yet to make it work. Please let me know if I should split each one of the issues on to a separate post.
1) Want the DTPicker1 in the UserForm on open with today's date.
2) Can't get the Date from DTPicker1 and time LDTime1 entered in a single cell without the double spacing.
3) If you open the UserForm, don't select a date and click insert the date format is mm/dd/yyyy but if open the UserForm then select a date and click insert the date format is dd/mm/yyyy which is the format I need.
Any help recieved will be greatly appreciated.
Please find attached a workbook with a UserForm I've created to pick the time and date.
8739
The code behide the UserForm as follows.
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
ActiveCell.ClearContents
Unload Me
End Sub
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
DTPicker1.Value = Date
End Sub
Private Sub Insert_Click()
If DTPicker1 <> "Select Desired Date" Then
ActiveCell.Value = DTPicker1.value & " " & LDTime1.TimeString
End If
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
This the code used to open the UserForm.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("C6:F13")) Is Nothing Then
Cancel = True
Datetime1.Show
End If
End Sub
I've have a number of issues as listed below on how I would like the UserForm to run but do not have the VBA knowledge yet to make it work. Please let me know if I should split each one of the issues on to a separate post.
1) Want the DTPicker1 in the UserForm on open with today's date.
2) Can't get the Date from DTPicker1 and time LDTime1 entered in a single cell without the double spacing.
3) If you open the UserForm, don't select a date and click insert the date format is mm/dd/yyyy but if open the UserForm then select a date and click insert the date format is dd/mm/yyyy which is the format I need.
Any help recieved will be greatly appreciated.