vba hide comments on worksheet in Excel

Q146.How can I hide all comments in my WorkSheet using VBA?

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 excel vba hide comments on worksheet

 

You can find similar Excel Questions and Answer hereunder

1) How can I add a WorkSheet and name it as required using VBA?

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

3) Line break in vba message box in Excel

4) How do I add a shape using VBA?

5) How can I identify all cells with Conditional Formatting in my WorkSheet?

6) How can I insert a watermark in my Worksheet?

7) How to disable ability to insert Rows and Columns in Excel (using VBA)?

8) How can I prevent users from seeing / accessing my macro code?

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

10) How can I add a legend to a chart using VBA?

11) How can I hide a sheet completely from users (the sheet should not even appear in Unhide dialog box)?

12) How can I set non-contiguous print area using VBA?

13) How can I update a listbox based on data in a list using VBA?

14) How can I change the Marker size and Marker line color for all the series in a chart?

15) How can I set the fill color, font color and set number format of cell to date?