REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

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.

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.

Range(“YourRange”).ClearComments

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()
    Range("A2:D10").ClearComments 
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.

Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Last Updated: March 2, 2023

Leave A Comment