Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Ranges and Find/Replace Spare Excel Programming 1 March 31st 08 03:54 PM
Unable to replace cell references with Named ranges lhim2 Excel Discussion (Misc queries) 0 January 28th 08 04:13 PM
How to replace cells by (predefined) ranges firsttimer Excel Programming 1 May 31st 07 10:43 AM
Replace a spreadsheets named cells/ranges with exact cell address. David McRitchie Excel Discussion (Misc queries) 0 September 28th 05 08:59 PM
Replace a spreadsheets named cells/ranges with exact cell address! ExcelMonkey Excel Programming 0 September 16th 05 12:21 PM


All times are GMT +1. The time now is 05:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"