How to Create an Excel Button to Enter Today's Date in Cell B3
Question details
The user wants to create an interactive button within their spreadsheet that, when clicked, automatically inserts the current date into cell B3.

- Product
- Microsoft Excel / WPS Spreadsheet
- Device & OS
- not provided
- Scenario
- Setting up a daily log, invoice, or data entry form where the current date needs to be quickly populated into a specific cell without manual typing.
- Observed behavior
- Currently, the date must be typed manually or updated via a volatile function. The user needs a static date insertion triggered by a single click.
Ensure that the Developer tab is enabled in your ribbon and that your spreadsheet is saved as a Macro-Enabled Workbook (.xlsm) so the VBA code functions correctly.
Use a VBA Macro and a Form Control Button
You can automate this task by writing a tiny VBA script that writes today's date to cell B3, and then assigning that script to a standard Form Control Button.
This solution works perfectly in both Microsoft Excel and WPS Spreadsheet. It uses a basic VBA command to fetch the system's current date and place it exactly where you need it.
If you don't see the Developer tab at the top of your screen, go to File > Options > Customize Ribbon, and check the box next to 'Developer' in the right pane. Click OK.
Press Alt + F11 to open the VBA Editor. In the top menu, click Insert > Module. In the new window, paste the following code: Sub InsertDate() Range("B3") = Date End Sub Close the VBA Editor to return to your spreadsheet.
Go to the Developer tab, click on 'Insert' (in the Controls group), and select 'Button (Form Control)'. Click and drag on your worksheet to draw the button.
As soon as you release the mouse button after drawing, an 'Assign Macro' dialog box will appear. Select 'InsertDate' from the list and click OK. You can now right-click the button, choose 'Edit Text', and rename it to 'Insert Date'.

Create Interactive Spreadsheets with WPS Spreadsheet
WPS Spreadsheet offers built-in, comprehensive support for VBA macros and form controls. Automating repetitive data entry tasks like inserting timestamps takes only seconds in WPS Office.
- 1. Open your Spreadsheet: Launch WPS Spreadsheet and open your document. Ensure the Developer tab is enabled in your workspace.
- 2. Add the VBA Script: Navigate to the Developer tab, click 'Macros' or press Alt + F11, insert a new module, and type the date insertion macro.
- 3. Draw and Link the Button: Click 'Insert' in the Developer tab, draw a Form Control button, and select your newly created macro from the prompt.

Frequently Asked Questions
How do I make the button insert the date into a different cell instead of B3?
You can change the target cell by opening the VBA Editor (Alt + F11) and modifying the range in your code. For example, to target cell D10, change `Range("B3") = Date` to `Range("D10") = Date`.
Can I have the button insert both the date and the exact time?
Yes. Open your macro in the VBA Editor and replace the word `Date` with `Now` (so the line reads `Range("B3") = Now`). Make sure cell B3 is formatted to display both the date and time.
Why do I get an error saying macros are disabled when I click the button?
By default, spreadsheet software disables macros for security reasons. You need to go to your Trust Center settings to enable macros, and ensure you have saved your file as a Macro-Enabled Workbook (.xlsm).
Is it possible to make the button insert the date into the currently selected active cell?
Absolutely. If you want the date to appear wherever you currently have clicked, change the VBA code from `Range("B3") = Date` to `ActiveCell.Value = Date`.




