Hi John,
Try a different approach using string functions. You might find the sample
code below useful:
Sub Sample()
MsgBox SubsTxt("with OLD text", "OLD", "NEW")
End Sub
Function SubsTxt(strComment, strOld, strNew As String)
Dim BeforeOld, AfterOld As String
'without error handling!!! strOld must be in strComment!!!
BeforeOld = Left(strComment, InStr(1, strComment, strOld) - 1)
AfterOld = Right(strComment, Len(strComment) - Len(BeforeOld) _
- Len(strOld))
SubsTxt = BeforeOld & strNew & AfterOld
End Function
Best,
Rafael
"John Svendsen" wrote:
Hi All,
I've been looking around for how does one Find and Replace text strings in
Cell Comments.
There is a lot of info on addind, deleting, text, but I did no find anything
on replacing/changing existing text.
I've tried
activecell.comment.text Replace(activecell.comment.text, "old", "new")
but no go
Does anyone have any ideas?
Thanks a lot
JS