Thread: Time choice
View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.misc
Shane Nation Shane Nation is offline
external usenet poster
 
Posts: 12
Default Time choice

That is great - thank you so much. I wish I knew half of what you can put
together.

Thanks

Shane
"Bob Phillips" wrote in message
...
With this solution, you get the calendar and the time form at the same
time,
but you do time first then date.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A2:A100"

If Target.Cells.Count 1 Then Exit Sub

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Calendar1.Left = .Left + .Width - Calendar1.Width
Calendar1.Top = .Top + .Height
Calendar1.Visible = True

' select Today's date in the Calendar
Calendar1.Value = Date

frmTime.Show
If frmTime.fTimeOK Then
.Value = Format(frmTime.SelectedTime, "hh:mm")
End If
End With

ElseIf Calendar1.Visible Then
Calendar1.Visible = False
End If

End Sub


You also need to change the Calendar Click procedure.


Private Sub Calendar1_Click()
With ActiveCell
.Value = CDbl(Calendar1.Value) + .Value
.NumberFormat = "dd-mmm-yyyy hh:mm:ss"
.Select
Calendar1.Visible = False
End With
End Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Shane Nation" wrote in message
...
Sorry Bob I have not gone away yet, me being thick, I can't seem to

combine
both the Calendar and the time select code in the same work book. I have
attached the two.

Any ideas?

Shane
"Bob Phillips" wrote in message
...


"Shane Nation" wrote in message
...
Thanks Bob that would be just right if I could get the chosen time
into
the
cell I click in.

Just replace

MsgBox Format(frmTime.SelectedTime, "hh:mm")


with

.value = Format(frmTime.SelectedTime, "hh:mm")

And I could hold of the code so I can place it in the sheet
I am working with?


What do you mean by that?