What is the syntax to get the date selected for a calendar?

  1. Add a calendar to your userform (for instructions, click here)
  2. As shown in the screenshot below, select your calendar control (default name is always MonthView1)
  3. Select DateClick, as shown circled in red below
  4. A procedure will be auto-generated, containing a parameter called DateClicked
  5. User’s selected date is automatically contained in variable DateClicked

unnamed.png

Advertisements

What is the syntax to add a calendar to a userform?

VBA IDE > View > Toolbox > Right-click on Toolbox window > Additional Controls > check Microsoft MonthView Control 6.0 (SP6) > In Toolbox, select MonthView control > drag calendar onto your userform

unnamed.jpg

What is the syntax to open a userform?

Put the code below in a separate module from that of the userform. A common choice for users is the proceduce of Workbook_Open() under module ThisWorkbook.

Private Sub Workbook_Open()
    <user form name>.Show
End Sub

 

Do not use the load method, as this just loads the form but does not make it visible. Besides, Show option automatically loads it anyway.

Load <user form name>