LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to tell if Replace() did a replacement?

Hi all-
I've got some excel code that does a search & replace through a number
of files. it has a list of values & new values to replace those with,
then it opens one of the files, and iterates though the list of
replacements. once it's done cycling through the list of replacements,
it closes the open file and opens a new one, starting the cycle again.
this all works fine.

What doesn't work fine is: I can't seem to get it to tell me correctly
whether it found anything with the replace. some of the files won't
have any replacements within. I'd like to keep a list of which files
got replacements (just a count would be fine) and which didn't.

I've tried many variations on the following
y= range.replace("old","new")

no matter what, y returns True, whether it made a replacement or not.

I suppose I could do an Instr() first and then do the replacement if
instr() is not 0 then increment the counter but I'd like to figure out
why the Replace() keeps returning True.

TIA,
Tim


 
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
Value Replacement palups Excel Worksheet Functions 6 November 20th 09 02:38 AM
#N/A Replacement Susana C via OfficeKB.com Excel Discussion (Misc queries) 2 December 29th 06 05:06 PM
replacement for IF function? fastballfreddy Excel Discussion (Misc queries) 7 May 8th 06 04:56 PM
Replacement mowen Excel Discussion (Misc queries) 1 September 7th 05 09:01 PM
Replacement CD Greg Maloney Excel Programming 0 June 18th 04 11:29 AM


All times are GMT +1. The time now is 02:57 AM.

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

About Us

"It's about Microsoft Excel"