How to Add Date Picker in Excel VBA Forms

Printer-friendly versionPrinter-friendly versionSend by emailSend by emailPDF versionPDF version
The pop-up date picker for MS Excel

If you are using MS Excel for the longest time or if you are just new to this prowerful spreadsheet program, you might want to add some date picker functionality on your sheets. This fancy feature is mostly encountered on web forms but they can be applied or utilized in MS Excel too using Visual Basic for Applications (VBA) forms.

The use case for this varies depending on who would actually use the spreadsheet. If you are the Excel VBA programmer, you might want to utilize a macro that can manipulate user entries with dates using the date picker. If you are the user, you can use templates or macro-enabled spreadsheets to have this pop-up calendar type Date Picker in your workbooks.

How to Use the Date Picker in VBA Forms

If you are wondering to to use a Date Picker in one of your Excel workbooks, the procedures are described below. I am using MS Excel 2010 but the same procedures apply for Excel 2007, and 2013. I have not yet tested Excel 2016 for this.

Step 1: Open your MS Excel and then click on the Developer tab. If you do not see the Developer tab at the top of your menus, please follow this link for the detailed procedures.

Excel 2010 Developer tab missing

Excel 2010 with the Developer tab

Step 2: When the Developer tab is open, on the leftmost group of icons called Code, click on Visual Basic. A new window shall open named Visual Basic for Applications. This window can also be shown by simply pressing the Alt+F11 key combination while viewing the Excel window. (No need to go to the Developer tab).

Visual Basic icon

Step 3: In the Visual Basic for Applications window, click on the Insert menu, then click on User Form. Then a new form component appears on the file list on the left, and a new form object appears.

Inserting the UserForm

Step 4: When the UserForm object is shown, by default the small Toolbox appears as well. If you are not seeing it on your screen, click on the View menu, then click on Toolbox to enable or show it.

Step 5: By default, the calendar pop-up Date Picker control is not yet enabled and not listed on the default set of controls on the Toolbox. To enable it, right-click on any buttons or controls on the Toolbax, then click Additional Controls...

Toolbox additional controls

Step 6: In the list of Additional Controls, scroll down to the middle or bottom part, locate of the item listed as Microsoft MonthView Control 6.0 (SP6), click on it to mark it for selection, then click OK.

List of Additional Controls

Step 7: The Additional Controls dialog box disappears, and then look at the Toolbox and confirm that the calendar icon Date Picker is now shown on the Toolbox.

The date picker control is now enabled

 

Step 8: Now you are ready to select the MonthView button and create the pop-up calendar Date Picker on the UserForm.

Date Picker control on a user form

 

One of the problems that other people encounter when doing the procedures above is that, the Microsoftr MonthView Control 6.0 is NOT listed in the Additional Controls dialog box. This is because MSCOMCT2.OCX file is missing in their system.

The procedures below describe how the MSCOMCT2.OCX can be downloaded and registered to your Windows OS running the compatible version of MS Office in order to enable and activate the Microsoftr MonthView Control 6.0

How to Install and Enable the Microsoftr MonthView Control 6.0

NOTE: Close your MS Excel and other MS Office programs before following the steps below.

Step 1: Download the cabinet file containing the OCX file needed for the date picker to work. This file is no longer accessible at the MSDN network so I made it available on the cloud. Here is the link => http://filesxpress.com/download-5462074c403d150e9abc55efdbf1ec35

Step 2: Extract the contents of the cabinet file into a folder. You can name it MSCOMCT2. The contents of the cabinet file are 2 files shown below:

Large icons view of the contents of the CAB file

Step 3: The file with no extension is actually a batch file. It will automatically execute the registration of the OCX file to the System32 folder. So you right click on the file with no extension, then click on Run as Administrator. When you got the UAC prompt, click OK or YES to confirm.

Step 4: The action initiated by this batch file is actually copying the OCX file to the System32 folder and then executing the registration of the library by invoking the regsvr32.exe command.

Step 5: If you are using a 64-bit version of Windows, there are extra steps needed. Copy the OCX file to the SysWOW64 folder. The actual path is C:\Windows\SysWOW64

Step 6: When prompted with the UAC, click OK or YES to confirm the action.

Step 7: After copying, open an elevated command prompt. To do this, right-click on the Windows logo (Start menu) then click Command Prompt (Admin).

Step 8: In the elevated command prompt, type or copy and paste this command below into the command prompt and then press Enter to execute.

regsvr32.exe C:\Windows\SysWOW64\MSCOMCT2.OCX

Registering the OCX file

 

Then close all programs and then the open MS Excel. The Microsoftr MonthView Control 6.0 shall be listed now and can be enabled to allow you to add the pop-up calendar Date Picker using the procedures above.