Excel Date Picker

Updated on December 27, 2023
Article byWallstreetmojo Team
Reviewed byDheeraj Vaidya, CFA, FRM

How to Insert Date Picker in Excel?

In Excel, the drop-down calendar is technically known as Microsoft Date and Time Picker Control. It is inserted with the help of ActiveX Control and is not available for the 64-bit version of MS Excel.

Key Takeaways

Example 1.9.0
You can download this Date Picker Excel Template here –  Date Picker Excel Template

Example 1 –The Date Picker Insertion

We have the data of the employees of an organization. The different fields are–”employee code,” “employee name,” “employee joining date,” and “employee department.”

The Excel data is in the following format. We need a drop-down calendarDrop-down CalendarThe calendar drop-down in Excel is an effective way of ensuring correct data entry and records, and it can be created with the data validation option to ensure error-free use.read more to enter the joining date of the employee.

Excel Date Picker Example 1

A drop-down calendar makes it easy for the user to enter the joining dates. For this, we insert an ActiveX Control named “Microsoft Date and Time Picker Control 6.0 (SP6).”

The steps to create a drop-down calendar are listed as follows (the first three steps make the Developer tab visible):

  1. Step 1: Under the “file” menu, choose “options.”


  2. Step 2: A dialog box named “excel options” opens. In the option “customize ribbon” (on the left edge of the dialog box), click on the checkbox for the “developer” tab. Click “Ok.”


  3. Step 3: The Developer tab appears at the end of the Excel ribbon.


  4. Step 4: In the Insert tab (under the Controls group), choose “more controls” from ActiveX Controls.


  5. Step 5: Choose “Microsoft Date and Time Picker Control 6.0 (SP6)” from the list and click “Ok.”


  6. Step 6: Click anywhere on the worksheet to create the drop-down calendar.


  7. Step 7: Right-click on the date picker and choose “properties” from the list.


  8. Step 8: In the “CheckBox” property, change the value from “false” to “true.” This allows the null values to be accepted. Close the “properties” dialog box.


  9. Step 9: Right-click on the date picker and choose “view code” from the contextual menu.

    Step 10: In Visual Basic Editor, a code is already written. Replace this existing code with the following code.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Sheet1.DTPicker1

.Height = 20

.Width = 20

If Not Intersect(Target, Range("C:C")) Is Nothing Then

.Visible = True

.Top = Target.Top

.Left = Target.Offset(0, 1).Left

.LinkedCell = Target.Address


.Visible = False

End If

End With

End Sub

–>> If you want to learn Excel and VBA professionally, then ​Excel VBA All in One Courses Bundle​ (35+ hours) is the perfect solution. Whether you’re a beginner or an experienced user, this bundle covers it all – from Basic Excel to Advanced Excel, Macros, Power Query, and VBA.

Example 2 –The Code Explanation

The explanation followed by the code within a block is given as follows:

#1 – The first statement tells the Excel compiler to run the code whenever a new cell is selected (i.e., the selection is changed). The selected cell is sent to the sub procedure as “target.”

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

#2 – The next statement sets the height and the width of the date picker to 20 points in Excel.

Note: We use the “with” operator so that we do not refer to “DTPicker1” again and again.

 With Sheet1.DTPicker1
.Height = 20
.Width = 20

#3 – The “If” clause sets the following criteria:

If any cell is selected in column C, only then does the date picker become visible. The “Intersect” function returns the address if a cell is selected in column C; otherwise, the value is null.

If Not Intersect(Target, Range("C:C")) Is Nothing Then
.Visible = True

#4 – The “top” property of the date picker is equal to the “top” property value of the selected cell. This means that it goes along with the upper border of the selected cell.

.Top = Target.Top

#5 – The next statement sets the “left” property of the date picker equal to that of the next right cell (of the selected cell). This is the distance of the left border (of column D) from the extreme left of the worksheet.

Note: To get the reference of the next right cell, we use the “OffsetOffsetThe OFFSET function in excel returns the value of a cell or a range (of adjacent cells) which is a particular number of rows and columns from the reference point. read more” function with “0” as the row argument and “1” as the column argument. This gets a reference to the cell in the next column.

.Left = Target.Offset(0, 1).Left

#6 – This statement links the date picker with the target cell. It allows the value selected in the drop-down calendar to be displayed in the cell.

.LinkedCell = Target.Address

#7 – The “else” statement tells the compiler not to display the date picker when a cell other than that in column C is selected.

.Visible = False

#8 – At the end, we close the “If” statement.

End If

#9 – We also close the “with” statement.

End With

#10 – Now, the sub procedure ends.

End Sub

Note: The file should be saved with the extension “.xlsm.” This allows the VBA codeVBA CodeVBA code refers to a set of instructions written by the user in the Visual Basic Applications programming language on a Visual Basic Editor (VBE) to perform a specific task.read more to run when any cell is selected in column C.

Example 3 – The Date Picker Operation

With the selection of a cell in column C, the drop-down calendar appears at the top right corner of the selected cell.

The working of the drop-down calendar is explained as follows:

  • The drop-down calendar can be opened by clicking the down arrow.
Excel Date Picker Example 1.10
  • To enter a date in the selected cell, click on that date from the calendar of the required month.
Example 1.11
  • To go to the previous or the next month, click the arrow buttons placed at the left and the right side of the calendar.
Excel Date Picker Example 1.12
  • The month can be chosen from the drop-down calendar by clicking on it.
 Example 1.13
  • The required year can be chosen and changed by clicking the up and down arrow buttons.
Excel Date Picker Example 1.14

Frequently Asked Questions

How to customize the Excel date picker?
The steps to customize the date picker are listed as follows:

1. Select the calendar control and put on the “design mode.” Alternatively, drag a corner of the date picker (design mode on) to resize it.
2. In the “properties” window, set the desired height, width, and font.
3. Drag the control when the cursor changes to a four-point arrow. This moves the date picker to the preferred location.
4. Select the date picker and on the Format menu, make changes to “borders and shading.” This changes the border and the color of the date picker.

When is the Excel date picker used?
The date picker is used in the following situations:

– To display the billing and shipping dates of customer orders
– To show the departure dates of flights on travel request forms
– To show the joining date of employees in the Excel database of an organization
– To display the date of birth on insurance forms

How to select a date range in the Excel date picker?

For selecting the date range, the user has to select the start and the end date of a process. In such cases, the date picker displays two input boxes adjacent to each other.
The date picker control assists the user to insert “to” and “from” dates on a form template. Such range selection in the calendar is often used in flight applications. With the selection of the two dates, the date range is highlighted in the calendar.

This has been a guide to the Excel date picker. Here we discuss how to insert the date picker in Excel along with practical examples and a downloadable Excel template. You may learn more about Excel from the following articles –