VBA For Filtering Comments in a Column

mayoung

Active Member
Joined
Mar 26, 2014
Messages
259
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I am using Office 365 excel Is there away to filter Comments NOT Notes in a Column? Can be using a helper column if necessary.
I have the ability to filter Notes in a column but want to filter Comments.
Any help would be appreciated.
 
Maybe that's because there are no cells in column c that have comments? At least not that I can see in what you provided for download.
EDIT - more bizarre - there's no code that I can see in your workbook.
#2 ok, I see comments now, but no code. The borders make it very had to see the indicators.
 
Last edited:
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I've run out of editing time on the prior post.

So dumb me - for the last 20 years or so, I'd click alt+i+m and what popped up was a comment box. When I did that in my test sheet, the code worked on those comments. What I have in my sheet is now called "notes" as of version 365. Now "comments" are threads of some sort.
I will have to see what I can learn about that, but first I'll try my code, which for some reason, I don't see in either of your sheets. If I put "notes" in my sheet, then it makes no sense why my "comments" code worked on that.
 
Upvote 0
Maybe that's because there are no cells in column c that have comments? At least not that I can see in what you provided for download.
I've run out of editing time on the prior post.

So dumb me - for the last 20 years or so, I'd click alt+i+m and what popped up was a comment box. When I did that in my test sheet, the code worked on those comments. What I have in my sheet is now called "notes" as of version 365. Now "comments" are threads of some sort.
I will have to see what I can learn about that, but first I'll try my code, which for some reason, I don't see in either of your sheets.
Thank You for your help
 
Upvote 0
I've run out of editing time on the prior post.

So dumb me - for the last 20 years or so, I'd click alt+i+m and what popped up was a comment box. When I did that in my test sheet, the code worked on those comments. What I have in my sheet is now called "notes" as of version 365. Now "comments" are threads of some sort.
I will have to see what I can learn about that, but first I'll try my code, which for some reason, I don't see in either of your sheets. If I put "notes" in my sheet, then it makes no sense why my "comments" code worked on that.
Your TestComments2 hides the rows with Notes. How can this be modified to hide the Rows without Notes. For my future use?
 
Upvote 0
What you have are termed CommentsThreaded, so try
VBA Code:
Sub TestComments()
Dim Lrow As Long, i As Long

Lrow = Sheets("WIP-SUMMARY").Cells(Rows.Count, "C").End(xlUp).Row
For i = 2 To Lrow
    If Not Range("C" & i).CommentThreaded Is Nothing Then
       ' Debug.Print Rows(i).Address
        Rows(i).EntireRow.Hidden = True
    End If
Next

End Sub
Your TestComments2 hides the rows with Notes. How can this be modified to hide the Rows without Notes. For my future use?
Then I guess remove Not from the test:
If Range("C" & i).Comment Is Nothing Then
Rows(i).EntireRow.Hidden = True

I tried the other codes you were given but those did strange things, like hide all the rows up to around 325 so not sure what's going on there. I should have looked into CommentThreaded way back then but I missed the clues.
 
Upvote 0
Solution
For filtering as desired (column A in this example)

VBA Code:
Sub jec()
 Dim it, sp
 Set sp = Cells(99999, 1)
 
 For Each it In Range("A2", Range("A" & Rows.Count).End(xlUp))
    If it.CommentThreaded Is Nothing Then Set sp = Union(sp, it)
 Next

 sp.EntireRow.Hidden = True
End Sub

This code works.
 
Upvote 0
What you have are termed CommentsThreaded, so try
VBA Code:
Sub TestComments()
Dim Lrow As Long, i As Long

Lrow = Sheets("WIP-SUMMARY").Cells(Rows.Count, "C").End(xlUp).Row
For i = 2 To Lrow
    If Not Range("C" & i).CommentThreaded Is Nothing Then
       ' Debug.Print Rows(i).Address
        Rows(i).EntireRow.Hidden = True
    End If
Next

End Sub

Then I guess remove Not from the test:
If Range("C" & i).Comment Is Nothing Then
Rows(i).EntireRow.Hidden = True

I tried the other codes you were given but those did strange things, like hide all the rows up to around 325 so not sure what's going on there. I should have looked into CommentThreaded way back then but I missed the clues.

Your code worked I just had to modify and remove the Not

If Range("C" & i).CommentThreaded Is Nothing Then
' Debug.Print Rows(i).Address
Rows(i).EntireRow.Hidden = True

Thanks Again.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,322
Members
452,635
Latest member
laura12345

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