How to insert date stamp into a cell if ticked a checkbox in Excel?
Normally, you enter a date stamp by using hotkeys in Excel. How about insert date stamp into a cell by a checkbox in Excel? When ticking the checkbox, the time stamp is inserted into a specified cell automatically. This article will help you to solve it.
Insert date stamp into a cell if ticked a checkbox with VBA code
Insert date stamp into a cell if ticked a checkbox with VBA code
This section will introduce a VBA script to help you insert a date stamp into a cell automatically if ticked a checkbox in Excel. Please do as follows.
1. After inserting a check box, 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 > Module. Then copy and paste the below VBA code into the Module window.
VBA code: Insert date stamp into a cell if ticked a checkbox
Sub CheckBox_Date_Stamp()
Dim xChk As CheckBox
Set xChk = ActiveSheet.CheckBoxes(Application.Caller)
With xChk.TopLeftCell.Offset(, 1)
If xChk.Value = xlOff Then
.Value = ""
Else
.Value = Date
End If
End With
End Sub
3. Press Alt + Q keys to close the Microsoft Visual Basic for Applications window.
4. Right click the check box, and select Assign Micro from the right-clicking menu. See screenshot:
5. In the Assign Macro dialog box, select CheckBox_Date_Stamp in the Macro name box, and then click the OK button. See screenshot:
When ticking the check box, the date stamp will be inserted into the adjacent cell automatically.
Related articles:
- How to change a specified cell value or color when checkbox is checked in Excel?
- How to highlight cell or row with checkbox in Excel?
- How to make checkbox checked based on cell value in Excel?
- How to filter data based on checkbox in Excel?
- How to hide checkbox when row is hidden in Excel?
- How to create a drop down list with multiple checkboxes in Excel?
Best Office Productivity Tools
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...
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!






















