Write a Selected Calendar Date to an Excel Cell
Question details
Write a date selected in an Excel calendar to a specific worksheet cell.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A user selects a date in a calendar control and clicks a button to place it on a worksheet.
- Observed behavior
- The calendar displays dates, but the selected date is not written to the worksheet.
Identify the calendar’s confirmation button, the worksheet and target cell, and the variable or control property that holds the selected date. Open the workbook in a version of Excel that supports its VBA calendar control.
Assign the selected date in the calendar button’s click event
Use VBA to write the date to a worksheet cell when the user clicks the calendar’s button.
The example assumes selectedDate already contains the chosen date and is accessible to the button’s event procedure. The way you obtain that value depends on the calendar control.
In Excel, select Developer > Visual Basic. In the VBA editor, open the calendar’s form and double-click its confirmation button to open the Click event.
Inside the button’s Click procedure, add: ThisWorkbook.Worksheets("Sheet1").Range("A1").Value = selectedDate. Replace Sheet1 and A1 with your worksheet and target cell, and replace selectedDate with the variable or expression that holds the selected date.
Use File > Save As to save the workbook as an Excel Macro-Enabled Workbook (.xlsm). Reopen it, enable macros if prompted and appropriate, select a date, and click the calendar button to check the target cell.

Enter and manage worksheet dates with WPS Spreadsheets
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface. Open compatible Excel files and enter dates directly in cells for a straightforward move to WPS. The Excel VBA calendar control and its button event may not work the same way in WPS.

Frequently Asked Questions
How do I write the date to a different cell?
In the button’s Click event, change ThisWorkbook.Worksheets("Sheet1").Range("A1") to the worksheet name and cell address you want to use.
Where does selectedDate come from?
It represents the date chosen in your calendar. Use the variable or control property supplied by your calendar implementation, and make sure its value is accessible inside the button’s Click procedure.
Why does the cell show a number instead of a date?
Excel stores dates as serial numbers. Select the target cell, open Home > Number Format, and choose a date format.
Which file format preserves the VBA code?
Choose File > Save As and select Excel Macro-Enabled Workbook (.xlsm). A standard .xlsx file does not preserve VBA macros.




