Knowing how to use a calendar control in Microsoft Office Excel can make your application more dynamic. Excel is a spreadsheet application commonly used to analyse large amounts of data. Visual Basic for Applications (VBA) is a computer programming language developed by Microsoft to automate routine tasks in Microsoft Office applications. A calendar control is used to choose a date that you can then apply in your application.
- Skill level:
Other People Are Reading
Start Microsoft Office Excel, select the "Developer" tab then click "Visual Basic." Click the "Insert" menu and select "UserForm."
Right-click the "Toolbox" menu and select "Additional Controls...". Check the box next to "Calendar Control 12.0" then click "OK."
Click the calendar control and add it to "UserForm1." Click the "CommandButton" control and add one to your "UserForm1." Double-click the "CommandButton1" to open Microsoft Visual Basic.
Copy and paste the code below inside the "CommandButton1_Click()" subroutine.
Dim data String As String
data String = Calendar1.Value
ActiveCell = data String
ActiveCell.NumberFormat = "mm/dd/yy"
Press "F5" to run the program then click "CommandButton1." The program will get the calendar date chosen by user and will add it to the active cell in the Excel spreadsheet.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for