Replace in ranges does not work.
Hi everyone,
My copy of Excel 2003 shows some unexpected behavior with regard to replacing strings within a range. I have this code: Set shtImp = ActiveWorkbook.Worksheets("Import") With shtImp.UsedRange .Replace What:="=", Replacement:="'=", LookAt:=xlPart, SearchOrder:=xlByColumns End With The result of this code is the replacement of "=" by "'=" in the entire workbook, where only the replacement of the string on the Import worksheet was intended. How do I modify the code to achieve the desired result? I do not want to have to activate the Import worksheet, select the range in question and perform replacing within the selection. Can anyone help me out here? Thank you, Cooz |
Replace in ranges does not work.
If you ever come across this strange behavior, try Help | Detect and
Repair... and/or Open - Open and Repair... It obviously had to do with some kind of corruption. The code works fine now. Cooz "Cooz" wrote: Hi everyone, My copy of Excel 2003 shows some unexpected behavior with regard to replacing strings within a range. I have this code: Set shtImp = ActiveWorkbook.Worksheets("Import") With shtImp.UsedRange .Replace What:="=", Replacement:="'=", LookAt:=xlPart, SearchOrder:=xlByColumns End With The result of this code is the replacement of "=" by "'=" in the entire workbook, where only the replacement of the string on the Import worksheet was intended. How do I modify the code to achieve the desired result? I do not want to have to activate the Import worksheet, select the range in question and perform replacing within the selection. Can anyone help me out here? Thank you, Cooz |
All times are GMT +1. The time now is 03:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com