ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find Replace (https://www.excelbanter.com/excel-programming/283815-re-find-replace.html)

Chip Pearson[_2_]

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






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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com