Calendar control for Excel VBA
2016/06/11
[ad#top-1]
There is not a calendar control in Excel VBA, so I made it.
It can be downloaded from the following link.
https://sites.google.com/site/applistjp/calendarform-for-excelvba
The following figure is the calendar control I made. A left form is a sample to test it. When “Run” button is clicked, Calendar is shown. When a date box in Calendar is clicked, a date value is returned in TextBox
As event processing of “Run” button, It’s only enough to write the following 3 lines code.
Private Sub CommandButton1_Click() |
Call CalendarForm.setDate(TextBox1.Text) |
Call CalendarForm.setCallBackControl(TextBox1) |
CalendarForm.Show |
End Sub |
Not only TextBox but also Label can be used.
Private Sub CommandButton1_Click() |
Call CalendarForm.setDate(Label1.Caption) |
Call CalendarForm.setCallBackControl(Label1) |
CalendarForm.Show |
End Sub |
As a characteristic function, date value can be put in Sheet Cell. The folloing is a example.
The source code is following:
Sub sample_cell() |
Call CalendarForm.setDate(Range(“B2”)) |
Call CalendarForm.setCallBackCell(“B2”) |
CalendarForm.Show |
End Sub |
[ad#ad-1]
スポンサーリンク