Changing Comment Color for a Single User

Written by Allen Wyatt (last updated September 24, 2021)
This tip applies to Excel 2007, 2010, and 2013


3

Mikki is looking for a way to change the default color on worksheet comments so that she can tell her comments apart from comments made by other people.

When you add a comment to a cell in a worksheet, Excel allows you to change the formatting used for that comment. Once the comment is created, follow these steps:

  1. Right-click on the cell and choose Edit Comment from the Context menu. This places the insertion point within the comment where you can type more information, if desired.
  2. Right-click on the comment's border and select Format Comment from the resulting Context menu. Excel displays the Format Comment dialog box.
  3. Use the controls in the dialog box to change how you want the comment to appear.
  4. Click OK.

These steps are all fine and good, but they affect only the current comment. If you want to set a default for any comments you add in the future, Excel doesn't remember your formatting and it provides no way to make a change to the defaults. Instead, Excel grabs its default comment formatting from Windows itself. You can modify this by changing the display properties for Windows, specifically the ToolTip display setting. If you modify this, then you have modified how Excel formats your comments. (You've also modified how ToolTips appear in every other program on your system, as well.)

A workaround is to use a macro to insert your comments. The macro can not only insert the comment, but also format it according to your needs. Here's an example of a short macro that will insert a comment for the selected cell and, if the user's name is "Mikki," make the background color turquoise. (The user's name is defined in the setup for Excel.)

Sub AddMyComment()
    Dim sUserName As String
    Dim  addr As String

    sUserName = Application.UserName

    With ActiveCell
        addr = .Address

        If sUserName = "Mikki" Then
            ActiveSheet.Range(addr).AddComment
            Range(addr).Comment.Shape.Select True
            Selection.ShapeRange.Fill.ForeColor.SchemeColor = 41
        Else
            Range(addr).AddComment
        End If
    End With
End Sub

If you already have a worksheet that contains many comments, you might want to look for comments that have the text "Mikki" within them and then change the color of those comments. This macro fits the bill:

Sub ColorMyComments1()
    Dim myCom As Comment

    For Each myCom In ActiveSheet.Comments
    If InStr(myCom.Text, "Mikki") <> 0 Then
        myCom.Shape.Fill.ForeColor.SchemeColor = 41
    End If
    Next myCom
End Sub

Understand that the macro will change the color if the text "Mikki" appears anywhere within the comment text. A slight variation of the macro checks the comment's Author attribute, and if it is set to "Mikki," then it makes the change:

Sub ColorMyComments2()
    Dim myCom As Comment

    For Each myCom In ActiveSheet.Comments
    If myCom.Author = "Mikki" Then
        myCom.Shape.Fill.ForeColor.SchemeColor = 41
    End If
    Next myCom
End Sub

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12567) applies to Microsoft Excel 2007, 2010, and 2013.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Accessing Excel through a PDF File

Word and PDF files go together like peanut butter and jelly. (How's that for a metaphor?) If you create PDF files from ...

Discover More

Copying Fill Color in a Table

You may spend some time getting the color in a portion of a table just right, only to be faced with the task of copying ...

Discover More

Comparing Formulas on Two Worksheets

As you develop worksheets, it is not unusual to end up with two that are essentially the same. At some point you may want ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More ExcelTips (ribbon)

Changing the Comment Indicator Color

Add a comment to a worksheet, and you'll notice that Excel places a small, red triangle at the upper-right corner of the ...

Discover More

Anchoring Comment Boxes in Desired Locations

Want your comment boxes to appear someplace other than the right side of a cell? You may be out of luck, and here's why.

Discover More

Filtering for Comments (Notes)

Excel makes it easy to filter a data table based on various values in that table. It isn't so easy to filter according to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 5?

2013-07-09 07:08:53

Frank S

Can you modify this macro to change the default comment font size too?


2013-03-25 09:58:49

Duncan Philps-Tate

With a little bit of modification, you can arrange for a different colour for each author that's found. This needs a loop in the Else statement of the If and an array to hold the authors' names. For simplicity I've started from color 40 and limited the upper end to color 52 once more than 12 authors have been found - this is partly for readability in my own scheme. There is an upper limit on SchemeColor of 80 in any case. Your own author name which appears by default when you create a comment is held as a constant edited into the macro.

Here's the important part of the code:
If myCom.Author = sMyAuthor Then
myCom.Shape.Fill.ForeColor.SchemeColor = 40 'myCom.Shape.Fill.ForeColor.SchemeColor + 1
Else
For i = 0 To UBound(myPeople)
If myPeople(i) = myCom.Author Then
myColor = 41 + i
If myColor > 52 Then myColor = 52
bAuthorExists = True
Exit For
End If
Next 'i

If Not bAuthorExists Then
ReDim Preserve myPeople(UBound(myPeople) + 1)
myPeople(UBound(myPeople)) = myCom.Author
End If

myCom.Shape.Fill.ForeColor.SchemeColor = myColor

End If


2013-03-23 10:28:19

Peter Atherton

I hadn't realised that the Author property applied to comments. I think that that will suit Mikki the best. Congratualtions to the op who supplied that.

Peter


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.