Cell Comment
Here's a slight variation with AutoSize.
Public Sub AddOrAppendComment(s As String)
With ActiveCell
If .Comment Is Nothing Then
.AddComment s
Else
.Comment.Text (.Comment.Text & vbLf & s)
End If
.Comment.Shape.TextFrame.AutoSize = True
End With
End Sub
Dana DeLouis
"JE McGimpsey" wrote in message
...
Frank - this won't append the new comment to an old comment.
Instead try:
Public Sub AddOrAppendComment()
Const sMYCOMMENT As String = "My Comment"
Dim sExisting As String
With ActiveCell
If .Comment Is Nothing Then
.AddComment sMYCOMMENT
Else
sExisting = .Comment.Text
.Comment.Delete
.AddComment sExisting & " " & sMYCOMMENT
End If
End With
End Sub
In article ,
"Frank Kabel" wrote:
Hi
use something like
with activecell
on error resume next
.comment.delete
on error goto 0
'insert your comment
end with
-----Original Message-----
I want to add a comment from VBA to a cell, I have
recorded the addcomment part but it falls over fi there
is alreadya comment in place, how do I checkto see if the
cell already has a comment, then append the new comment
to the old Comment ?
.
|