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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657
Try one of these

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

    Application.DisplayCommentIndicator = 0

Chas
 

RAM

Well-known Member
Joined
Oct 4, 2004
Messages
1,862
Thanks Chas, I'll will. Meanwhile, what is the difference between the second and the third code?

RAM
 

RAM

Well-known Member
Joined
Oct 4, 2004
Messages
1,862
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
 

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657

ADVERTISEMENT

RAM, that is correct, first will leave red triangle
 

Chas17

Well-known Member
Joined
Oct 16, 2002
Messages
657
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
 

RAM

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

I'll try it later. I'll let you know.

RAM
 

RAM

Well-known Member
Joined
Oct 4, 2004
Messages
1,862
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
 

Forum statistics

Threads
1,141,924
Messages
5,709,369
Members
421,632
Latest member
BrennieB

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
Top