ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find and Replace Exact Match (https://www.excelbanter.com/excel-programming/391307-find-replace-exact-match.html)

Katie

Find and Replace Exact Match
 
Good Morning,

I'm feeling rather dumb this morning and have a somewhat simple question -

At the end of a rather long set of code, I have 30 find and replace features
that will essentially convert mixed sets of text/numbers into the correct
"Title". The problem I am running into is that some of the shorter sets of
mixed characters are contained within the longer sets, so those get replaced
but not in their entirety.

For instance;

Find "Red,," = Replace with "Immediate"
Find "Red,,blue" = Replace with "Possible"

So, in the current order this will create "Immediate" on the top example,
but "Immediateblue" on the second example.

Is there a way to change find and replace to find and replace if cell
matches exactly or should I just change the order around so that the longest
strings come first?



Helmut Weber[_2_]

Find and Replace Exact Match
 
Hi Katie,

for a better answer at least I would need more examples.

In the paticular case of
Find "Red,," = Replace with "Immediate"
Find "Red,,blue" = Replace with "Possible"


just change the order to
Find "Red,,blue" = Replace with "Possible"
Find "Red,," = Replace with "Immediate"


Maybe that is just the simplest solution.


--
Gruß

Helmut Weber, MVP WordVBA

"red.sys" & chr$(64) & "t-online.de"
Win XP, Office 2003 (US-Versions)


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com