How to auto add date and time to comment in Excel?
When you insert a comment into a cell, a user name will be inserted automatically by default. Have you ever wondered if the current date and time can be auto added to the comment as well? This will help you to quickly identify the time you created the comments. This article, I will introduce some tricks for you to deal with this problem in Excel.
Without typing the data and time into the comment box, you can use these short cut keys to insert the data and time quickly and easily. Please do as follows:
1. Click one cell that you want to insert a comment with the current data and time, and then right click to choose Insert Comment form the context menu, see screenshot:
2. After inserting the comment, in the comment box, press Ctrl +; to insert the current date, and type a space bar, then press Ctrl + Shift +; to insert the current time, and the current data and time has been added into the comment at once, see screenshot:
3. And then you can edit your comment as your need.
If you are not familiar with the short cut keys, don’t worry, here, I can talk about a VBA code to help you insert the date and time automatically.
1. Select the cell which you want to insert the comment.
2. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
3. Click Insert > Module, and paste the following code in the Module Window.
VBA code: Auto add date and time to comment
Sub DatedComment() 'Update 20141110 Dim pComment As Comment Dim WorkRng As Range Set WorkRng = Application.ActiveCell Set pComment = WorkRng.AddComment(Application.UserName & ":" & vbLf & Now & vbLf) pComment.Shape.TextFrame.Characters(1, VBA.Len(Application.UserName) + 1).Font.Bold = True End Sub
4. Then press F5 key to run this code, and a comment will be inserted to the selected cell with the date and time automatically, and you can edit the comment as your need, see screenshot:
Tip: This VBA cannot work if the selected cell has already been inserted comment before.
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)