Thank you for the reply.
I'm sorry I forgot to mention I'm an intermediate Excel user still learning how to code. How do you mean "For each of shapes"? This message was edited by R2 on 2002-10-09 05:48
This macro will search each comment on the active sheet for the text entered by the user. It currently only works on the active sheet but could be modified to work in all sheets, or even in all workbooks.
Let me know how you get on.
Dim strTextToFind As String
Dim cmt As Comment
Dim blnFound As Boolean
On Error GoTo Bail
strTextToFind = InputBox("Find what?", "Search for text in comments")
If strTextToFind = "" Then Exit Sub 'User pressed cancel
'Now search each comment on the active sheet for the text
'specified for the user.
For Each cmt In ActiveSheet.Comments
If InStr(1, cmt.Text, strTextToFind, vbTextCompare) > 0 Then
blnFound = True
cmt.Visible = True
MsgBox "Cell : " & cmt.Parent.Address & vbCrLf & _
"Value : " & cmt.Text, vbInformation, Chr(34) & strTextToFind & Chr(34) & " found"
cmt.Visible = False
If blnFound = False Then MsgBox "The search text was not found on this sheet.", vbInformation, "No match found"
If Err.Number <> 0 Then MsgBox Err.Description, vbExclamation, "An error occurred"