ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calendar (https://www.excelbanter.com/excel-programming/307914-calendar.html)

Terry V

Calendar
 
Hello
I have an application where I use a calendar on a userform (userform1).
Im trying to have the user select a date, type in information into an
inputbox and then get prompted again if they want to select another date,
but (as you probably know), when I click on the calendar to select another
date, the code runs again from the beginning.

How can I have it prompt the user "do you want to enter another date?" ; up
to a maximum of 5 times (when they select NO on the msgbox (vbNo), it should
exit the loop.

Thank you
Terry V



Terry V

Calendar
 
I did find "a" solution --- although many of you will agree; its not pretty:

Private Sub Calendar1_Click()
Dim dte As Date
Dim x As Integer
Dim msg As String
Dim results
Dim tme As String
Dim msg2 As String

dte = Me.ActiveControl
tme = InputBox("What time do you work?", "Input Hrs")
UserForm1.Hide
workinghrs = workinghrs & vbCrLf & dte & " " & tme
msg = "Do you want to enter another day?"
'UserForm1.Show
results = MsgBox(msg, vbYesNo)
If results = vbYes Then
UserForm1.Show
Else
msg2 = "Here are your hrs, please copy and paste them" & vbCrLf & workinghrs
MsgBox msg2
End If

End Sub

Thank you
Terry



"Terry V" wrote in message
...
Hello
I have an application where I use a calendar on a userform (userform1).
Im trying to have the user select a date, type in information into an
inputbox and then get prompted again if they want to select another date,
but (as you probably know), when I click on the calendar to select another
date, the code runs again from the beginning.

How can I have it prompt the user "do you want to enter another date?" ;

up
to a maximum of 5 times (when they select NO on the msgbox (vbNo), it

should
exit the loop.

Thank you
Terry V






All times are GMT +1. The time now is 10:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com