Code to hide all comments

RAM

Well-known Member
Joined
Oct 4, 2004
Messages
1,862
Hi Guys,

I could need a code to hides all comments in the open sheet.

Thanks

RAM
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try one of these

Code:
    Application.DisplayCommentIndicator = xlCommentIndicatorOnly
    
    Application.DisplayCommentIndicator = xlNoIndicator

    Application.DisplayCommentIndicator = 0

Chas
 
Upvote 0
Thanks Chas, I'll will. Meanwhile, what is the difference between the second and the third code?

RAM
 
Upvote 0
Second and third code returns the same results, but it also removes the red triangle that indicates a comment, and I'm not really enthusiastic over that. It does not only remove the triangle in the open sheet but in all sheets in all open workbooks

RAM
 
Upvote 0
RAM,
This will Hide the first 10 comments on the first sheet, which may not be Sheet1, adjust as you need.

Code:
Sub HideComments()
'9/15/2006 by Charles R. Weber
' hides first 10 comments on "first sheet" (which may NOT be Sheet1)
Dim i As Integer

For i = 1 To 10
    On Error Resume Next
    Worksheets(1).Comments(i).Visible = False
Next i
End Sub

or

Code:
Sub HideComments()
'9/15/2006 by Charles R. Weber
' hides first 10 comments on ActiveSheet
Dim i As Integer

For i = 1 To 10
    On Error Resume Next
    ActiveSheet.Comments(i).Visible = False
Next i
End Sub

Chas
 
Upvote 0
Thanks. The second one seems to work great. This second code is also faster than the first codes we tried out. It doesn't lag me in my tabbing down the column. The red triangle doesn't seem to disappear either.


RAM
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

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