Skip to main content

How to pop up a calendar when clicking a specific cell in Excel?

Supposing there is a column range in a worksheet you need to frequently enter and change dates inside, but it is bored to enter or change date manually per time. How to quickly enter dates without manually typing into the column range? This article is talking about popping up a calendar when clicking on cells in a certain range, then inserting date into the selected cell automatically after selecting date in the calendar.


Pop up a calendar when clicking a specific cell with VBA code

Please solve this problem as follows step by step.

Note: This method can only work on Microsoft Excel 32-bit.

Step 1: Create a UserForm with calendar

Please create a UserForm which contains the calendar you will pop up by clicking on a cell.

1. Press Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, click Insert > UserForm.

3. Then a UserForm and a Toolbox windows pop up, in the Toolbox, click any one control and right click, then select Additional Controls from the right-clicking menu. See screenshot:

4. In the Additional Controls dialog box, scroll down to check the Microsoft MonthView Control option in the Available Controls box, and then click the OK button.

5. Then you can see the MonthView button is added in the Toolbox window. Please click this MonthView button, and then click on the UserForm1 window to create a Calendar in the Userform.

Note: You can adjust the size of the UserForm window to suit the inserted calendar by dragging the border of the UserForm.

6. Double click the inserted calendar in the UserForm1, and in the Code window, please replace the original code with the following VBA script.

VBA code: create a user form with calendar

Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
 On Error Resume Next
   Dim xRg As Object
   For Each xRg In Selection.Cells
      xRg.Value = DateClicked
   Next xRg 
   Unload Me
End Sub

Note: This code can help to insert date into selected cell after selecting date from calendar.

Step 2: Activate the Calendar when clicking on cell

Now you need to specify certain cells to pop up calendar when clicking. Please do as follows.

7. Double click the sheet name which contains the cells you will click to pop up calendar in the left Project pane, then copy and paste the below VBA code into the Code window. See screenshot:

VBA code: Click cell to pop up calendar

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If (Target.Count = 1) Then
    If Not Intersect(Target, Range("A2:A10")) Is Nothing Then UserForm1.Show
    End If
End Sub

Note: in the code, A2:A10 are cells you will click to pop up calendar. Please change the cell range as you need.

8. Press Alt + Q keys simultaneously to close the Microsoft Visual Basic for Applications window.

From now on, when click on any cell inside the specified range in current worksheet, a calendar will pop up as below screenshot shown. And date will be inserted automatically into the selected cell after selecting date from the calendar.


Pop up a calendar when clicking a specific cell with VBA code

This section introduces the Date Picker utility of Kutools for Excel. After enabling this feature, click a date cell will pop up a calendar, you can easily replace the existing date with a new date with it. Please follows the below steps to apply this feature.

1. Click Kutools > Content > Enable Date Picker.

2. After enabling this feature, click on a date cell, and a calendar icon will pop up right to the cell.

3. Click the calendar icon to open the Date Picker dialog box, and then click a new date to replace the date in selected cell.

Notes:

  • Undo button: Click this button to undo replacing date;
  • Close button: Click this button to close the Date Picker dialog box;
  • This feature can only apply to cells containing date.

  If you want to have a free trial (30-day) of this utility, please click to download it, and then go to apply the operation according above steps.


Related articles:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
Comments (18)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I am not seeing the Microsoft MonthView Control in the listing, but it may be as Pete (#32847) mentioned that this will not work in Office 365 or 64-bit Microsoft Office.
This comment was minimized by the moderator on the site
Hi Teagan Caudle,
I searched and tried the methods suggested in google, but ultimately could not register the MonthView control in Microsoft 365.
Sorry for the inconvenience. Maybe you can check this out.
https://social.technet.microsoft.com/Forums/Azure/en-US/db3b4dff-aad7-4d88-87cc-8f3f117be550/microsoft-windows-common-controls-60-for-office-2016
This comment was minimized by the moderator on the site
There is no Microsoft MonthView Control listed (Office 365), and the directions here doesn't explain how one would get that control, so this is pretty much useless unless you're using an older version of Excel.
This comment was minimized by the moderator on the site
The calendar will show up but when I click on the date, the cell doesn't populate
This comment was minimized by the moderator on the site
Hi,
The code works well in my case. Which Excel version are you using?
This comment was minimized by the moderator on the site
Thank you so much! These directions were super useful :)
This comment was minimized by the moderator on the site
Hi, Is it possible to put the date picker pop-up for multiple column, as in my sheet I have "start date", "end date" and "agreement date". if yes then how?
This comment was minimized by the moderator on the site
Hi jeet,
Follow the steps and replace the range "A2:A10" in the second VBA code with your column range (such as C2:E2).
This comment was minimized by the moderator on the site
Salve il codice funziona benissimo, ma se volessi farlo funzionare anche su un altro foglio
This comment was minimized by the moderator on the site
if i try to select a row, the pop up will activate and the date appears in each cell in that row


how can i avoid this
This comment was minimized by the moderator on the site
Hi Sam,
The code has been updated in the article with the problem solving. Please have a try and thank you for your comment.
This comment was minimized by the moderator on the site
tarihi seçebiliyorum ama a1:a10 hücrelerine seçtiğim tarih eklenmiyor. teşekkür ederim
This comment was minimized by the moderator on the site
Hello everyone,

Can anyone tell me how to popup a calendar in a range of cells, but starting only from the cell right bellow a table header and down bellow in an excel column.


Thank you in advance.
This comment was minimized by the moderator on the site
Use i.e: Range("B6:C30")
This comment was minimized by the moderator on the site
Good Day,
Sorry I didn't got your question. Would be nice if you could provide screenshot of what you are trying to do.
This comment was minimized by the moderator on the site
Use i.e: Range("B6:C30")
This comment was minimized by the moderator on the site
i used these VBA codes and everthing's fine so far. The range is A2:A10 and calendar pops up when you select a cell into it. But if you mark row from 2 to 10 again the calendar pops again. It's the same with column "A" if you mark it, again the calendar pops. How should i proceed, in order to get the calendar only in the range i've defined?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations