Datepicker Excel



Why isn't there a date picker in Excel? Sam Rad from the Excel team wondered the same thing and has given the world an awesome Date Picker for Excel. The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value. Date Picker Calendar in Excel VBA. Oftentimes, users want to click a button and select a date. This is no different for Excel developers. Check out this ActiveX control by Microsoft that allows users to do just that. It’s a little old school looking, but actually has quite a nice feel to it. Hi All, I've made a sheet with a date picker that works fine, but when the book is reopened the picker doesn't work until I click 'Source' in the developer tab at which point it comes to life and works perfectly.

Custom Excel Date Picker

Issue with the MonthView Control

Excel does not really provide a good way for the user to pick a date from a calendar when your application is running, for my applications I had to come up with Custom Excel Date Picker. Yes, you could use the Monthview control but over the years I have found it somewhat unreliable and on most machines it is simply not available by default. You would need to browse the internet and look for the mscomct2.ocx file and then use the command prompt to register it (or ask your IT department to do it for you if you do not have admin privileges, which makes it a bigger pain). The other issue I have found is that if someone who does not have this file installed opens the application to which you added the MonthView control, the MonthView control will simply be deleted by Excel and you need to add it again (what a pain).

My Date Picker version

My version offers more flexibility and relies solely on the userform controls which come installed by default on all Excel versions. Below I will go through the parameters you can customize.

You can choose a Start Date

By using the .StartDate property you can choose the day that the Custom Excel Date Picker will show when it first loads up. If you omit this parameter then it will default to the current day.

You can choose a Minimum Date and Maximum Date

Datepicker Excel Vba

By using the .MaxDate and .MinDate properties you can tell the Custom Excel Date Picker not to scroll, respectively, after the month of the MaxDate or before the month of the MinDate. For instance if you choose as MaxDate 13 November 2019, the Date Picker will not scroll beyond November 2019. I found this feature quite useful if you want to restrict the range of dates a user can pick.

You can choose the weekdays order

Excel

By using the property WeekBeginsOn, you can establish the order of the days of week with which the date Picker shows the calendar. If vbMonday then dates are shown from Monday to Sunday. If vbSunday then dates are shown Sunday to Saturday. If vbFriday then from Friday to Thursday. If you omit this property then it defaults to vbUseSystemDayOfWeek (based on local Windows settings).

You can unable the user to pick a date outside the current month

If you set the property AllowUserToSelectDaysNotInMonth to FALSE then the user will not be allowed to select a date which is outside the current displayed month. For instance, if the Date Picker is currently displaying February 2018, the user cannot select the dates End of January or Beginning of March.

You can unable the user to pick a day that falls in a weekend

Date picker excel cell

Date Picker Excel 365

By setting the DenyWeekendsSelection property to TRUE the user will not be able to select Saturdays or Sundays.

Date Picker Excel Cell

Excel

Datepicker Excel 2016

Date picker excel cell

Date Picker Excel 2016

Let me know what you think or some features you would like to see added in the comments below.