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

excel vba activeworkbook.saveasmerge multiple sheets into oneproject checklist template wordmsg in vbahow to identify duplicates in excelhow to use sumif formula in excel 2010excel estimating templatesget file name vbamicrosoft word project plan templatevba replace methodduplicate cell excelcan you merge cells in excelproject scope template excelvba code functionfreshers interview questions and answers technicalhiding cells in excelvba join arrayexcel tutorials for beginnersvba closevb6 ado exampleschedule planner excelexcel list boxexcel find last cellexcel vba database connectionremove blank cells in excel formulabasics of sas programmingvba option buttonexcel vba combobox changems access vba sqlsort excel macroexcel vba copy rowworkbooks open vbavbscript check if file existsexcel basics tutorialsum of vlookupexcel macro copy worksheetautofilter in vbaexcel vlookup examplescase vbasql interview questions in pdfexcel password cracker macroword template meeting agendamicrosoft excel vba programming for dummies 2010construction cost estimator excelvba array lengthfont color excel vbapassword protection excel 2010excel function hlookupvba end xlupwhat do you mean by vlookup in excelsas do until loopwrite vba codevba ms wordhow to insert a column in excelvba end looppivot table basicssum if sqlhow to adjust cell width in excelexcel sumif examplesexcel macro save workbookhow to use trim function in excelhow to unhide all sheets in excelmessagebox custom buttonshow to tick a box in excelsql interview questions and answers for freshers pdf downloadcode vbaexcel null cellvbcritical vbavba convert to integerxml file to excel converterdcl data control languagehyperlink in vbasample sql interview questionsexcel remove headerexcel for begginers