Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello all,
Here is my code: Public Sub EnterTime() Dim pdteInputBox As Date gintMsgBoxResponse = MsgBox("The current time is: " _ & Format(Time, "h:mm AM/PM") & "." & vbCrLf & vbCrLf _ & "Would you like to enter this time?", vbQuestion + _ vbYesNo, "Current Time") If gintMsgBoxResponse = vbYes Then ActiveCell.Value = Time Else pdteInputBox = TimeValue(InputBox("Please enter the correct time.", _ "Time", Format(Time, "h:mm AM/PM"))) If pdteInputBox = "" Then Exit Sub Else ActiveCell.Value = pdteInputBox End If End If gintMsgBoxResponse = 0 End Sub The problem I'm having is if I answer "No" to the message box and then enter a time (9:03) in the input box and hit "OK", I get a "Run-time error '13': Type mismatch". I also noticed that I got the same error when I hit "Cancel" on the input box. Any help would be greatly appreciated, Conan Kelly |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert Calculated Field (wrong Qty*Price = wrong Amount) | Excel Discussion (Misc queries) | |||
What am I doing wrong? | Excel Discussion (Misc queries) | |||
What's Wrong? | Excel Programming | |||
What is wrong in this Sub? | Excel Programming | |||
What do i wrong here | Excel Programming |