Does cell contain a comment?

mikeymay

Well-known Member
Joined
Jan 17, 2006
Messages
1,600
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

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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,214,641
Messages
6,120,685
Members
448,977
Latest member
dbonilla0331

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