Computing.Net > Forums > Office Software > Automatic Date Feature in Excel

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Automatic Date Feature in Excel

Reply to Message Icon

Name: ereyes83
Date: November 20, 2008 at 13:11:50 Pacific
OS: XP
CPU/Ram: XP
Product: XP
Comment:

In an excel file I have a list of names and want people to enter comments for the latest status. Is there a way for excel to calculate that date the comment field was last updated each time? So today is 11/20 but the last comment was posted 11/01, I'd like the date to say 11/01 automatically...

I would default all the dates to today's date then would like them to change as people update their statuses.




Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: November 20, 2008 at 18:05:50 Pacific
Reply:

The following was written by Julian Milano many years ago. I pass it along, hopefully with his permission.

Before I do, I'll add this:

Run this code to disable the user's ability to edit or delete comments via Right-Click. This will help them remember to use the custom button that Julian suggests.

With Application.CommandBars("Cell")
.Controls("Delete Comment").Enabled = True 'True to reset
.Controls("Edit Comment").Enabled = True
End With

*** Begin Included Text ***

The following will add a comment to a cell and place the user's name, time
of comment & date. If a comment exists, the new one will be appended to the
end. You could set this up as a button on a toolbar:

,

Sub CustomComments()
' Set up the Error Handler. This should only trigger
' when we try to add a comment to an existing comment
On Error GoTo ChkError
Selection.AddComment
Selection.Comment.Visible = False
AddNewComment ' The Error Handler didn't trigger,
' so add a new comment
Done: Exit Sub ' STOP- Do not go further.

ChkError: ' ERROR! A comment exists
If Err.Number = 1004 Then ' 1004 is the error that comes up
AddToComment ' Add to the existing comment
End If
Err.Clear ' Now clear the error
GoTo Done ' Finish off the macro
End Sub

Sub AddToComment()
OldCommentText = Selection.Comment.Text
NewCommentText = InputBox("The current Comment text is: " & _
Chr(10) & OldCommentText & Chr(10) & Chr(10) & "Enter new text: ")
Selection.Comment.Text Text:=OldCommentText & Chr(10) & _
Application.UserName & Chr(10) & Now() & Chr(10) & NewCommentText
End Sub

Sub AddNewComment()
NewCommentText = InputBox("Enter the new Comment text: " & _
Chr(10))
Selection.Comment.Text Text:=Application.UserName & Chr(10) & _
Now() & Chr(10) & NewCommentText
End Sub


***End Included Text ***


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Automatic Date Feature in Excel

Date format in Excel www.computing.net/answers/office/date-format-in-excel/7976.html

Excel date format in dd/mm/yy www.computing.net/answers/office/excel-date-format-in-ddmmyy/8378.html

Move to specific page in excel work www.computing.net/answers/office/move-to-specific-page-in-excel-work/4910.html