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.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
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.