any way to Filter by comments ?

iffi

Board Regular
Joined
Jun 5, 2011
Messages
59
Office Version
  1. 2019
Platform
  1. Windows
hi everyone, there r so many comments in different excel cells. i want to filter that data by comments so that i can do my work easily instead of looking at each cell and finding out which cell has comment.
what could be the easy way for this ? plz kindly reply me.
Thanks for ur co-operation as usual
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Post this into a Standard module
Highlight The range you wish to include Before Running Macro...
Caution Note before running -- See Next to last Code line Comment

Good Luck,
Jim

Rich (BB code):
Sub CopyComments()
Dim s As String
Dim r As Range
Dim i As Long
i = 1
For Each r In Selection 'Range("B3:D7")
    On Error Resume Next
    s = r.Comment.Text
    On Error GoTo 0
    If s <> "" Then
    Cells(i, 13).Value = WorksheetFunction.Substitute(s, Chr(10), " ")
    i = i + 1
    End If
    s = vbNullString
Next r
ActiveSheet.Range("M:M").ColumnWidth = 36  'THIS SHOULD BE A BLANK COLUMN !!!
End Sub
 
Upvote 0
not really filtering; but utillites

Code:
Sub CommentsShowAll()
'Display all comments of the active sheet
Dim C As Comment
For Each C In ActiveSheet.Comments
    C.Visible = True
Next
End Sub
Sub CommentsShowMine()
'Display all current user comments of the active sheet
Dim C As Comment
For Each C In ActiveSheet.Comments
    If C.Author = Application.UserName Then
        C.Visible = True
    Else
        C.Visible = False
    End If
Next
End Sub
Sub CommentsHideAll()
'Hide all comments of the active sheet
Dim C As Comment
For Each C In ActiveSheet.Comments
    C.Visible = False
Next
End Sub
Sub CommentsShowIf()
'Display all comments of the active sheet if search string is found in the comment
Dim C As Comment
searchstr = LCase(InputBox("Show Comments with:"))
For Each C In ActiveSheet.Comments
    If InStr(1, LCase(C.Text), searchstr) > 0 Then
        C.Visible = True
    Else
        C.Visible = False
    End If
Next
End Sub
 
Upvote 0
Thanks for ur quick reply, this one is nice but i also got a user defined function formulae for this which is working great, by this below function, i can filter by True value and return the cells only which has comment


Code:
Function CellHasComment(c As Range)
     Application.Volatile True
     CellHasComment = Not c.Comment Is Nothing
End Function
Now you can use a formula such as the following within a worksheet:
=CellHasComment(B2)

When the formula is executed, it returns either True or False, depending on whether cell B2 has a comment or not. You can then use Excel's filtering capabilities to display only those rows that have a True returned by the formula.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,275
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top