find and replace inside comments?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a large range of cells that contain comments. I want to change the
word linear to exponential in all the comments. Is there a way to do this?
 
Hi try this, it's case sensitive so you may need to play with the strings

Sub stitute()
For Each Comment In ActiveSheet.Comments
Comment.Text Text:=Replace(Comment.Text, "linear", "exponental")
Next
End Sub

Mike
 
you are the man! thanx!

Mike H said:
Hi try this, it's case sensitive so you may need to play with the strings

Sub stitute()
For Each Comment In ActiveSheet.Comments
Comment.Text Text:=Replace(Comment.Text, "linear", "exponental")
Next
End Sub

Mike
 
Replace does have another argument that you can specify to make it
case-insensitive.

But that doesn't mean that the case of the replaced word would match the case of
the existing word, though.
 
Back
Top