View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default replace in a split?

I put your stuff in C8

Sub stitute()
Dim r As Range, s As String
Set r = Range("C8")
s = r.Comment.Text
pieces = Split(s, Chr(10))
pieces(2) = "something else"
r.Comment.Text Text:=Join(pieces, Chr(10))
End Sub
--
Gary''s Student - gsnu200830


"Kevin" wrote:

If i have a cell with a comment in it and that comment has say 4 lines :
one
two
three
four

I know I can refer to a single line by using
Range(CurrAddress).Comment.text, vbLf)(2) which would refer to "Three"

But what if i want to replace the "three" with "someting else"?

Range(CurrAddress).Comment.text, vbLf)(2)="Something Else" doesn't work....

Thanks in advance
Kevin Green