Vba hide comments on worksheet in Excel

For example, I have a WorkSheet with lot of comments - under certain circumstances, I would like to "Hide" all comments.

excel vba hide comments on worksheet

To do it in Excel, here is the answer:

  1. OptionExplicit
  2. Public Sub ChangeDisplayStyle()
  3. Application.DisplayCommentIndicator = xlCommentIndicatorOnly
  4. End Sub

Description:

a) Running the above macro will hide all comments in the entire WorkBook.

b) To show all comments back again, "Application.DisplayCommentIndicator = xlCommentAndIndicator" can be used.

Result after Macro execution:

excel vba hide comments on worksheet

 

You can find similar Excel Questions and Answer hereunder

1) How can I hide Formula Bar and Headings using VBA?

2) How can I dynamically add a hyperlink using VBA?

3) How can I protect / unprotect WorkSheet using VBA?

4) How can I save a WorkSheet as a new WorkBook using VBA?

5) Tables in Excel VBA. How you can create table in VBA and work with them with macros

6) How to code more simply in VBA. Use of Keywords is helping a lot

7) How can I delete all shapes in a WorkSheet?

8) How to add a link in a sheet to another sheet

9) How to hide and unhide rows and columns in Excel

10) How can I get users to select a folder to save the output of my macro?

 

Here the previous and next chapter