Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Multiple Ranges and Find/Replace | Excel Programming | |||
Unable to replace cell references with Named ranges | Excel Discussion (Misc queries) | |||
How to replace cells by (predefined) ranges | Excel Programming | |||
Replace a spreadsheets named cells/ranges with exact cell address. | Excel Discussion (Misc queries) | |||
Replace a spreadsheets named cells/ranges with exact cell address! | Excel Programming |