• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Add Date To Text Boxes Using Calendar Form

kadrleyn

Member
A useful template about data selection & entry using option buttons on the userform , quick date entry into selected textboxes with a calendar form (Trevor Eyre's calendar form- https://chandoo.org/forum/threads/fully-customizable-vba-date-picker.19508/ ) that it is alternative to date picker.
When double-clicked on the textbox, the calendar form is displayed. The selected date is added to the text boxes in "mm/dd/yyyy" format.

77011

Code:
Private Sub txtDOTDate_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Call GetCalendar
End Sub

Sub GetCalendar()
    dateVariable = CalendarForm.GetDate(DateFontSize:=11, _
        BackgroundColor:=RGB(242, 248, 238), _
        HeaderColor:=RGB(84, 130, 53), _
        HeaderFontColor:=RGB(255, 255, 255), _
        SubHeaderColor:=RGB(226, 239, 218), _
        SubHeaderFontColor:=RGB(55, 86, 35), _
        DateColor:=RGB(242, 248, 238), _
        DateFontColor:=RGB(55, 86, 35), _
        TrailingMonthFontColor:=RGB(106, 163, 67), _
        DateHoverColor:=RGB(198, 224, 180), _
        DateSelectedColor:=RGB(169, 208, 142), _
        TodayFontColor:=RGB(255, 0, 0))

    If dateVariable <> 0 Then frmflightstats.txtDOTDate = dateVariable
    frmflightstats.Frame3.SetFocus
End Sub

Source
 
Back
Top