-
Why doesn't this work in a loop?
I'm using the following code to add comments to cells, or add to the existing comments in cells. For some reason, it will work fine the first time through, but not the second. Any ideas?
[VBA]Sub CommentTest()
Dim HasComment As Boolean
Dim oldCmtStr As String
Dim noteStr As String
noteStr = "hey there"
On Error Resume Next
HasCommnet = ActiveCell.Comment.Parent.Address = ActiveCell.Address
On Error GoTo 0
If HasComment = True Then
oldCmtStr = ActiveCell.Comment.Text
ActiveCell.Comment.Text Text:=oldCmtStr & Chr(10) & noteStr
Else
ActiveCell.AddComment Text:=noteStr
End If
End Sub[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules