View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_444_] joel[_444_] is offline
external usenet poster
 
Posts: 1
Default Calendar staying open


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