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 add comments to a range using VBA. When you are automating any task you may wants to write the comments dynamically based on the data. You can use Range.AddComment method to insert a comment to a particular range or a cell. The below example macro codes will show you – how to add or insert comments using VBA in Excel 2003,2007,2010,2013 or higher.

VBA AddComment Method Excel Range Object

Why we need to add comments using VBA

When we are automating any Excel task or preparing the Excel templates, it is better idea to provide enough information to the user. In some cases, the actual Cell or Range may not be sufficient to show the information, or you may want to show the additional information to the user or client (like instructions, help, or about the field, or you may want to to describe more about some data in a range or cell. Adding comments will be a good idea to provide such information, this will also help your worksheet looks more cleaner as comments will not appear until your user or customer hover on the cell or a range.

VBA Add Comments in an Excel Range – Syntax

You can use the below syntax or Macro Code to add or insert comments to a range in Excel using VBA.

Range(“YourRange”).AddCommnet “Your Text”

VBA to Add Comments in an Excel Range – Examples

Please look into the below examples will show adding comments in different situations while automating your tasks.

VBA to Add Comments in an Excel Range – Simple Example

The below example will show you how to add a comment at Range “A2” as ‘Hello, this is a comment text’:

Range("A2").AddComment "Hello, this is a comment text"

Here AddComment is method of an Excel Range to add the comments. And ‘A’ is the Column Name and ‘2’ is the Row number.

VBA to Add Comments in an Excel Range – Instructions

  1. Open an Excel Workbook from your start menu or type Excel in your run command
  2. Press Alt+F11 to Open VBA Editor or you can goto Developer Table from Excel Ribbon and click on the Visual Basic Command to launch the VBA Editor
  3. Insert a Module from Insert Menu of VBA
  4. Copy the above code for adding or inserting c comment into a range and Paste in the code window(VBA Editor)
  5. Save the file as Macro Enabled Workbook (i.e; .xlsm file format)
  6. Press ‘F5′ to run it or Keep Pressing ‘F8′ to debug the code line by line.

Now you can observe that a new comment is added at Range A2 as “Hello, this is a comment text”.

Real-time Applications on VBA AddComment to a Range Method

  • VBA Error Statement

VBA Error Statement

Error handling plays a pivotal role in ensuring smooth and predictable code execution. While VBA provides mechanisms to handle errors, there are instances where simulating errors becomes necessary. Enter the 'Error' statement. In this blog [...]

  • VBA Date Function

VBA Date Function

The VBA Date function is a built-in function that is used to return the current system date. It can also be used to specify a specific date by providing the year, month, and day arguments. [...]

  • VBA Time Function

VBA Time Function

The VBA Time function is used to return the current system time. It is similar to the 'Now' function, but it only returns the time and not the date. This function can be very useful [...]

  • VBA String Function

VBA String Function

The VBA String function is a built-in function in Microsoft Excel that allows users to create a string, or a sequence of characters, of a specified length. This function is commonly used in VBA (Visual [...]

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

One Comment

  1. MS office Support September 13, 2018 at 1:05 PM

    Nice Article! I am glad to know about VBA Add Comments to Excel Range. I often work on excel sheet so it is really helpful for me. Thank you for this information.

Leave A Comment