Excel Threaded Comments Macros

Excel Threaded Comments Macros

In Excel for Office 365, there are threaded comments, where you can have discussions with your co-workers. Or, reply to your own threaded comments, with updates on the data. The old-style comments are now called Notes, and they still work the way they always did. Here are a couple of macros that you can use to work with the new Excel threaded comments.

Threaded Comment Macros

The macros in this post are designed to work with the new Excel threaded comments only.

See a Threaded Comment

If a cell has a threaded comment, there’s usually a purple indicator in the top right corner of the cell. (Indicators can be turned off in Excel Options)

When you point to that cell, the threaded comment appears, starting at the top left corner of the next cell.

threadedcommentmacros02

See All Threaded Comments

On the Excel Ribbon’s Review tab, there is a Show Comments command, in the Comments group. The next group is for Notes – the old-style comments.

The first time you click the Show Comments command, a Comments Task Pane opens. In the task pane, you can:

  • see all the existing threaded comments, and their replies.
  • edit, delete and reply to the comments, or create new comments.

threadedcommentmacros04

If the Comments Task Pane is open:

  • threaded comments will not pop up beside the cell
  • you can click the Show Comments again, to close the task pane

Macro to Show/Hide Task Pane

Instead of using the Show Comments command to open and close the Comments task pane, you can use the following macro to show or hide it.

In the code, “Not” changes the Visible property to the opposite of its current setting

Sub ToggleThreadedComments()
With Application.CommandBars("Comments")
  .Visible = Not .Visible
End With
End Sub

In the sample file, there is a button on the worksheet to run the ToggleThreadedComments macro

threadedcommentmacros05

Macro to List All Threaded Comments

If you want to store the comments, or analyze them, use this macro to make a list of all the threaded comments on the active sheet, with a few details.

The list has these 6 columns:

  1. sequential numbers
  2. cell address
  3. author
  4. date
  5. number of replies
  6. comment text

threadedcommentmacros08

Code to List All Comments

Here is the code for the List All Comments macro. Copy the code, and put it in a regular code module in your workbook.

Sub ListCommentsThreaded()
Application.ScreenUpdating = False

Dim myCmt As CommentThreaded
Dim curwks As Worksheet
Dim newwks As Worksheet
Dim i As Long
Dim cmtCount As Long

Set curwks = ActiveSheet
cmtCount = curwks.CommentsThreaded.Count

If cmtCount = 0 Then
   MsgBox "No threaded comments found"
   Exit Sub
End If

Set newwks = Worksheets.Add

 newwks.Range("A1:F1").Value = _
     Array("Number", "Cell", "Author", _
      "Date", "Replies", "Text")

i = 1
For Each myCmt In curwks.CommentsThreaded
   With newwks
     i = i + 1
     On Error Resume Next
     .Cells(i, 1).Value = i - 1
     .Cells(i, 2).Value = myCmt.Parent.Address
     .Cells(i, 3).Value = myCmt.Author.Name
     .Cells(i, 4).Value = myCmt.Date
     .Cells(i, 5).Value = myCmt.Replies.Count
     .Cells(i, 6).Value = myCmt.Text
   End With
Next myCmt

With newwks
  .Columns(6).ColumnWidth = 50
  .Columns.AutoFit
  With .Cells
    .EntireRow.AutoFit
    .VerticalAlignment = xlTop
    .WrapText = True
  End With
End With

Application.ScreenUpdating = True

End Sub

More Threaded Comment Macros

There are more macros on the Excel Threaded Comment Macros page on my Contextures site. For example:

  • List all Comments and Replies
  • Number and List Comments
  • Remove Numbers

threadedcommentmacros10

Get the Sample File

To get the code for these macros, and to see more threaded comment macro examples, go to the Excel Threaded Comment Macros page.

There is sample code on the page, which you can copy and paste into your workbook. Or, go to the Download section on that page, and get the sample file. It has sample threaded comments for testing, and all of the macros. The zipped workbook is in xlsm format, and contains the macros from the page.

_____________________________________

Excel Threaded Comments Macros

threadedcommentsmacros01a

Excel Threaded Comments Macros

_____________________________________

5 thoughts on “Excel Threaded Comments Macros”

  1. Sorry I posted the wrong macro in the first post
    Sub ColorComments()
    Dim Rng As Range
    Dim WorkRng As Range
    On Error Resume Next
    xTitleId = “ColorComments”
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox(“Range”, xTitleId, WorkRng.Address, Type:=8)
    Set WorkRng = WorkRng.SpecialCells(xlCellTypeComments)
    Application.ScreenUpdating = False
    For Each Rng In WorkRng
    Rng.Interior.ColorIndex = 36
    Next
    Application.ScreenUpdating = True
    End Sub

    1. Thank you for posting this this macro. I noticed that it only pulls from one worksheet. How can I pull the threaded comments from all worksheets in my workbook and include the sheet name in the address column, or maybe add the sheet name in a separate column?

  2. Question on your Sub ListCommentsThreaded (), it is awesome (you know that!). My challenge is that I have workbooks with multiple sheets. I would like your code to go through the entire workbook, and then compile all comments on one sheet (“Comments”), and add a new column to indicate which sheet the comment came from, the cell # is in Column B, but the Sheet name would be needed also.

  3. Code to List All Comments really helped us as we are using the latest O365 Office – Excel which has Notes and Comments separate. We tried using GetComments() macro but it was fetching only NOTES and not comments.
    This code worked on one of the sample test file that I created locally and now will try it on the main project file.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.