AleemAM123
04-03-2011, 08:51 AM
I am trying to read the date and time from and active cell into a date and time picker control:
Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
DTPicker1.Value = DateValue(ActiveCell.Value)
Else
DTPicker1.Value = Date
End If
End Sub
This code picks up the date only and leaves the time out, any idea how I can get the time in?
Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
DTPicker1.Value = DateValue(ActiveCell.Value)
Else
DTPicker1.Value = Date
End If
End Sub
This code picks up the date only and leaves the time out, any idea how I can get the time in?