View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John[_22_] John[_22_] is offline
external usenet poster
 
Posts: 694
Default Calendar staying open

Hi Joel
I have a small problem I can't fix.
If I press the Cancel button on the "Inputbox", I get an error 13 Type mismatch.
I tried different error handling but no success.
Hope you can still help me
Regards
John
"joel" wrote in message
...

I removed the hide an added an inputbox to the code below. Add a
control button to the userform that says Exit and put the hide into the
button click function.


Private Sub CommandButton1_Click()
me.hide
End Sub

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
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub

Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
Set mycell = Application.InputBox( _
prompt:="Select a cell", Type:=8)

mycell.Value = Calendar1.Value

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=165975

Microsoft Office Help