![]() |
replace in a split?
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 |
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 |
replace in a split?
NICE!!! I like it.. I especially like your macro name!! :-)
Thank you much for the help.. "Gary''s Student" wrote: 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 |
replace in a split?
Very neat! -- mdmackillop ------------------------------------------------------------------------ mdmackillop's Profile: http://www.thecodecage.com/forumz/member.php?userid=113 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=57722 |
All times are GMT +1. The time now is 04:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com