View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default How to judge some cell that had been added comments?

Hi Terry,
If you try do AddComment when one already exists I think you first have
to delete the existing comment eg
ActiveSheetRange("A1").Comment.Delete.

Alternativing you can edit the comment like this:
ActiveSheetRange("A1").Comment.Shape.TextFrame.Cha racters.Text = "Blah
Blah Blah"

Also, when code is trying to do something to a comment that doesn't
exist an error results.
This error can be overcome using:

On Error Resume Next
ActiveSheetRange("A1").Comment.Shape.TextFrame.Cha racters.Text = "Blah
Blah Blah"
On Error Goto 0 'that's a zero, not an O

If A1 on Active Sheet doesn't have a comment the error message is
avoided. If A1 does have a comment it is changed to "Blah Blah Blah"

Does this help?

Ken Johnson