Calendar Control Help

  • Thread starter Thread starter Exceller
  • Start date Start date
E

Exceller

I have a Calendar pop up when a cell is chosen. How can I get the Calendar
to disappear after a date is chosen (instead of having to take the extra step
of clicking the Close button)?
Thanks.
 
Assuming the calendar is Calendar1, put the following code:
- in the userform if the calendar is in a userform
- in the sheet code module if the calendar is directly on the sheet

Private Sub Calendar1_AfterUpdate()
''' close code here
''' 1. run close button: CmdClose_Click
''' 2. or close the Userform if the calendar is in userform: Me.Hide
End Sub
 
Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
ActiveCell.Value = Format(Calendar1.Value, "dd-mmm-yy")
Unload Me
End Sub


Gord Dibben MS Excel MVP
 
Back
Top