Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search/Replace in Comments in Excel
Hi,
For performing Search/Replace in Comments of an Excel Sheet, I was abl to come up with something like: Code ------------------- Sub comments_replace() Dim FoundCell As Range Dim FindWhat As String Dim WithWhat As String FindWhat = "User" WithWhat = "XXX" Do Set FoundCell = ActiveSheet.Cells.Find(What:=FindWhat, _ After:=ActiveCell, _ LookIn:=xlComments, LookAt:=xlPart, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False) If FoundCell Is Nothing Then Exit Do Else FoundCell.Comment.Text _ Application.Substitute(FoundCell.Comment.Text, _ FindWhat, WithWhat) End If Loop End Sub ------------------- However, this code works well when i have "MatchCase:=True". If th "Match Case" option is set to true, the code gives me an error at th line "If FoundCell Is Nothing Then". My MS Excel freezes and stop responding. Please can someone help. Thanks, Lonel -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search/Replace in Comments in Excel
Don't know really, but try
Dim FoundCell as Object --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search/Replace in Comments in Excel
Hi Brian,
I tried using this, but it didnt work. Thanks, Lonel -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Search and replace help in Excel | Excel Discussion (Misc queries) | |||
Replace data by VALUE or COMMENTS not availabel in Excel 2003 ??? | Excel Discussion (Misc queries) | |||
Excel comments replace author | Excel Discussion (Misc queries) | |||
How do I do a search and replace in a textbox in Excel? | Excel Discussion (Misc queries) | |||
Find and replace for comments in excel 2003 | Excel Discussion (Misc queries) |