Cells.Comment

G

Guest

In a macro, How to find out if a cell has a comment or not

Assume that A1 has a comment "Hi" and B1 has no comment text, I need the
condition (below) to check if the cell has a comment :-

If ( condition ) Then
'Msgbox comment.text
End if




TIA!
 
G

Guest

Try selecting a cell and then:

Sub is_it_there()
Dim r As Range
On Error Resume Next
Set r = ActiveSheet.UsedRange.SpecialCells(xlCellTypeComments)
If Not Intersect(r, Selection) Is Nothing Then
MsgBox ("comment found")
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top