ExcelBanter

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

Oldjay

Calendar control
 
I have a command button that opens the calendar. It is for reference only.
I would like to have it close when ever I select a cell. I don't want to
have to click the close button

Kari J Keinonen[_2_]

Calendar control
 
Is that code what you need?

Private Sub CommandButton1_Click()
' You show calender
UserForm1.Show vbModeless
End Sub

' Put that code you Worksheet change -module
Private Sub Worksheet_SelectionChange(ByVal rng As Range)
Unload UserForm1
End Sub

OR

' Put that code you Workbook Sheet Chenge -module
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Unload UserForm1
End Sub


Regards Kari J Keinonen


All times are GMT +1. The time now is 04:01 AM.

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