Thread: Find Replace
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson[_2_] Chip Pearson[_2_] is offline
external usenet poster
 
Posts: 95
Default Find Replace

Bob,

If you want to replace text in the comment text, you can't use
Find and Replace. You have to look in the Text property of the
Comment object and replace the text directly. For example,

Dim Rng As Range
For Each Rng In
ActiveSheet.UsedRange.SpecialCells(xlCellTypeComme nts)
Rng.Comment.Text Replace(Rng.Comment.Text(), "replace text",
"New Text")
Next Rng


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


wrote in message
...
Is there a way to use this code and have it apply to Comments

only?
I am trying to use the MatchCase and LookAt options.

tia


rngMyCell.Cells(xlCellTypeComments).Replace _
What:=strEdit_Find, Replacement:=strEdit_Replace, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=True