VBA – Add or Remove Cell Comments

Associated Files Download Links

Modifying a worksheet from code? Add a cell comment to let the user know about what you’ve just done! The following code snippets show you how to add or delete a comment in a cell.

Add Cell Comment Using VBA

1. Put the following code somewhere in your macro to add a comment

Delete Cell Comment Using VBA

2. To delete a comment use this code

Edit Cell Comment Using VBA

3. To edit a comment you need to read the existing one and edit it. Use the code below

First, you need to read the existing comment in OldComment variable.

After that you can edit a comment, e.g. add the new text to the existing one in NewComment variable.

Now, you need to delete the old comment and add the new one. In order to delete the comment, you have to use the .Comment.Delete command.

Finally, you can add the comment from the NewComment variable using the .AddComent command.

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro – A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!

alt text


Learn More!

<<Return to VBA Examples

Did you find this VBA tutorial useful? Then share it with your friends and colleagues: