VBA ClearComments in Excel Explained with Examples

We can use VBA to Clear only the Comments of a specific range, cells or entire worksheet. we can use ClearComments method of Range Object. Rang.ClearComments method will clear only the comments in a range. And the data, formats like border, font styles, background cell will remain same and will not be disturbed.



50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates

VBA ClearComments Method Excel Range Object

Excel VBA to ClearComments a Range – Syntax

Here is the syntax to clear the comments in a range. You can clear the comments in any range or cells using VBA Range.ClearComments method.


Excel VBA to ClearComments in a Range – Examples

The below macro will show you how to clear the comments in a range using VBA. In this example, we are clearing the comments in range “A2 to D10” using VBA.

Sub VBA_Clear_Comments_Range()
End Sub

Excel VBA to Clear Comments in a Range – Instructions

Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:

  1. Open an Excel Workbook from your start menu or type Excel in your run command
  2. Enter some data in any cells in range “A10 to D10” to test this macro. Also format some cell and insert some comments for testing purpose.
  3. Press Alt+F11 to Open VBA Editor or you can go to Developer Table from Excel Ribbon and click on the Visual Basic Command to launch the VBA Editor
  4. Insert a Module from Insert Menu of VBA
  5. Copy the above code (for clearing the comments in a range using VBA) and Paste in the code window(VBA Editor)
  6. Save the file as Macro Enabled Workbook (i.e; .xlsm file format)
  7. Press ‘F5′ to run it or Keep Pressing ‘F8′ to debug the code line by line.

Now you can observe that the comments in the range “A2 to D10” are cleared. You can apply any formats and background color, and try this macro. This will clear only the comments. And formats and the data will be remained same.

If you want to clear everything including formats and data, you can use Range.Clear method, to clear the data in a range you use the Range.ClearContents method.

Range.ClearComments: Will clear only the comments. And the data and formats of the range will remain then same.
Range.ClearContents: Will clear only the content/data of the range, formats will remain same.
Range.Clear: Will clear the data including cell formats.


Leave A Comment

Related pages

where do i find a tick in excelexcel dashboard samplesvlookup meaning in excelvbs copy foldermerge cells in excel 2010unprotect excel sheetsms access vba msgboxvba columns selectmacro to close excel filevba excel automationexcel vba lookup value in arrayvba excel programmingvba enumerationcreate a worksheet in excelvba set cell colorshortcut for deleting rows in excelexcel macro beginnervba inputbox passwordclose workbook vbavba code for yes no message boxpowerpivot excel 2010 tutorialexcel macro to insert rowsexcel iferrorvb6 connect to sql serverlookup functions in excel 2010excel spreadsheet cost analysislearning excel macroscreating a macro in excel 2007vba delete empty rowsexcel vba rowdml in databasecosting sheet template excelduplicate formula excelworking with arrays in excelcapacity planning template in excel spreadsheetexcel shortcut to insert rowfilter out duplicates in excelcomment excel vbaexcel formula sum ifhow to count repeats in exceloffset meaning in hindihow to use multiple if condition in excelcool vbs codesmsgbox examplenested if statement in excel 2010how do i merge cells in excel 2013why we use vlookup function in excelintermediate excel tutorialunhide all sheets macroexcel dashboard torrentsql testing interview questions and answers pdfvba rowcountfso rename filejob estimate template excelhow to unhide the hide columns in excelhow to convert xls to xml formatvba excel modulevlookup example in hindilocation of personal xlsbmultiple pivot chartsvba excel columnslistbox properties in vbconstruction project excel templatevba sql whereexcel vba backcoloruse of excel formulas with examplemerging excelexcel financial dashboard templatesexcel vba listboxpivot table meaningexcel tutorial advancedexcel vba colour indexexample of vba codevlookup excel vbadisplay vba