#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 82
Default Edit All Comments

I have a lot of comments in a worksheet and have been requested to replace
one word in each of the comments with another word. Is there a way to
replace all occurences of the word without opening each and every comment one
at a time?
  #2   Report Post  
Posted to microsoft.public.excel.misc
KC KC is offline
external usenet poster
 
Posts: 94
Default Edit All Comments

There is a 'Replace All' button in 'Find and Replace' window (CTRL+H) right?
doesn't this work?

-kc
*Click YES if this helps

"watermt" wrote:

I have a lot of comments in a worksheet and have been requested to replace
one word in each of the comments with another word. Is there a way to
replace all occurences of the word without opening each and every comment one
at a time?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Edit All Comments

Hi,

Right click your sheet tab, view code and paste the code below in, Change
oldstring & new string for the text you want to find and replace

Sub EditComments()
oldstring = "Oldthing"
newstring = "Newthing"
Dim c As Comment
If ActiveSheet.Comments.Count 0 Then
For Each c In ActiveSheet.Comments
If InStr(c.Text, oldstring) 0 Then
newstring = WorksheetFunction.Substitute(c.Text, oldstring, newstring)
With Range(c.Parent.Address)
.ClearComments
.AddComment
.Comment.Text Text:=newstring
End With
End If
Next
End If
End Sub


Mike

"watermt" wrote:

I have a lot of comments in a worksheet and have been requested to replace
one word in each of the comments with another word. Is there a way to
replace all occurences of the word without opening each and every comment one
at a time?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 82
Default Edit All Comments

I keep getting a complie error when I run themacro.

"Mike H" wrote:

Hi,

Right click your sheet tab, view code and paste the code below in, Change
oldstring & new string for the text you want to find and replace

Sub EditComments()
oldstring = "Oldthing"
newstring = "Newthing"
Dim c As Comment
If ActiveSheet.Comments.Count 0 Then
For Each c In ActiveSheet.Comments
If InStr(c.Text, oldstring) 0 Then
newstring = WorksheetFunction.Substitute(c.Text, oldstring, newstring)
With Range(c.Parent.Address)
.ClearComments
.AddComment
.Comment.Text Text:=newstring
End With
End If
Next
End If
End Sub


Mike

"watermt" wrote:

I have a lot of comments in a worksheet and have been requested to replace
one word in each of the comments with another word. Is there a way to
replace all occurences of the word without opening each and every comment one
at a time?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Edit All Comments

Here is a small macro that changes "qwerty" to "new":

Sub CommentFixer()
Dim c As Comment
Set r = ActiveSheet.UsedRange.Cells.SpecialCells(xlCellTyp eComments)
For Each rr In r
rr.Comment.Text Replace(rr.Comment.Text, "qwerty", "new")
Next
End Sub
--
Gary''s Student - gsnu200903


"watermt" wrote:

I have a lot of comments in a worksheet and have been requested to replace
one word in each of the comments with another word. Is there a way to
replace all occurences of the word without opening each and every comment one
at a time?



  #6   Report Post  
Posted to microsoft.public.excel.misc
KC KC is offline
external usenet poster
 
Posts: 94
Default Edit All Comments

Mike, Gary,
that makes sense now, i did not read comment not as 'Excel comment'.... lol

-kc

"watermt" wrote:

I have a lot of comments in a worksheet and have been requested to replace
one word in each of the comments with another word. Is there a way to
replace all occurences of the word without opening each and every comment one
at a time?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I edit multiple comments at once Pat Excel Discussion (Misc queries) 0 July 30th 09 06:38 PM
Can't edit Comments any more tk77mann Excel Discussion (Misc queries) 0 March 16th 09 09:58 PM
Why can't I edit my comments in Excel? tfletch Excel Discussion (Misc queries) 4 May 20th 06 11:54 PM
Can't Edit Comments - Dean Excel Discussion (Misc queries) 5 December 15th 05 06:41 PM
Can't edit comments foxcole Excel Discussion (Misc queries) 6 February 1st 05 10:37 PM


All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"