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.
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.
- 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
Supports Office/Excel 2007-2021 and 365 | Available in 44 Languages | Easy to Uninstall Completely
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need Is Just A Click Away...
Supercharge Your Excel Skills: Experience Efficiency Like Never Before with Kutools for Excel (Full-Featured 30-Day Free Trial)
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! (Full-Featured 30-Day Free Trial)