Does cell contain a comment?

mikeymay

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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

patrickmuldoon99

Active Member
Joined
Jun 27, 2006
Messages
345
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
 

DominicB

Well-known Member
Joined
Oct 3, 2005
Messages
1,569
Good morning mikeymay

Does this help :

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

HTH

DominicB
 

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
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
 

Forum statistics

Threads
1,141,097
Messages
5,704,314
Members
421,338
Latest member
Pepess

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
Top