Does cell contain a comment?

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,598
Office Version
  1. 365
Platform
  1. Windows
Does anyone have some code that will check a cell for a comment? And if a comment is present, return the comment.


Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi Mikey

This will check if a comment exists in activecell, and if so, will return the comment in a message box:

Code:
Sub CommentCheck()
If ActiveCell.Comment Is Nothing = False Then
     MsgBox ("Comment Found: " & ActiveCell.Comment.Text)
Else
     MsgBox ("no comment here")
End If
End Sub
 
Upvote 0
Good morning mikeymay

Does this help :

Code:
Sub test()
If Not ActiveCell.Comment Is Nothing Then MsgBox ActiveCell.Comment.Text
End Sub

HTH

DominicB
 
Upvote 0
Here's one option:
Code:
Sub ReturnComments()
    If Intersect(ActiveCell, Cells.SpecialCells(xlCellTypeComments)) Is Nothing Then
        MsgBox "No comment!"
    Else
        MsgBox ActiveCell.Comment.Text
    End If
End Sub
Denis
 
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,122
Members
448,550
Latest member
CAT RG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top