When you insert a comment into Excel, your username is automatically inserted into the comment followed by a colon. For instance, if you log into your computer using the user name TrunkOfFunk. Your comments will all start with TrunkOfFunk:.
This annoys me to no end. Theoretically, this “feature” is supposed to tell you who inserted the comments. I don’t think I have ever needed to know that Donna inserted a comment into cell B2. In my opinion, the user name just clutters up the comment.
If you share my distain for the forced username in comments, here is a small procedure that will go through all comments and remove the username. This is especially handy for those of you who have embarrasing user names like Lou Briccant.
- Sub RemoveUserNames()
- Dim MyComment As Comment
- Dim I As Integer
- 'Start looping through comments
- For Each MyComment In ActiveSheet.Comments
- 'Find the position number of the Colon & LineFeed character combination
- I = InStr(1, MyComment.Shape.TextFrame.Characters.Text, ":" & vbLf)
- 'Use the position number to reset the comment text to all but the user name
- If I > 0 Then
- MyComment.Shape.TextFrame.Characters.Text = _
- Mid(MyComment.Shape.TextFrame.Characters.Text, I + 2)
- End If
- 'Go to the next comment
- Next MyComment
- End Sub