Find and Replace - quantum of replaces

od33n

New Member
Joined
Feb 12, 2013
Messages
8
Hi All,

till now, i am using this macro

select_all_icon.jpg
page_white_copy.png


<code style="margin: 0px; padding: 0px; font-style: inherit;"> Selection.Replace What:="SOMETHING", Replacement:="Something", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Selection.Replace What:="SOMEthing", Replacement:="Something", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False Selection.Replace What:="SOMething", Replacement:="Something", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False</code></pre>

i have these replaces very, very much after a time and it is very confusing, because i dont have very good control over same words etc.
You know, the replaces needs some logic so i have made "categories" of replaces. But now i d like to move on and question you if there is some better solution, in which i will be more able to read the code and know where i have to put some new replace strings.

Here is the best way i can imagine to work with this find replace macro

I think the best choice should be to take the find and replace strings in sheet named "replaces" for example and the routine will go row by row until empty row and in A column will be search strings, in B column replace strings. After null row, i would be happy if the string will start also at C (find string) and D column (replace string) etc. This last thing is about more categories for search... i like to have these separated by my logic. So after the routine will not find value in A, x or C, x or D, x etc, than script ends.

I dont know how to add example sheet, but can send you if i know where to.

I will be very happy, if the script will do the routine on SELECTION and with standard values as bellow(i just copied it bellow)
select_all_icon.jpg
page_white_copy.png


<code style="margin: 0px; padding: 0px; font-style: inherit;">LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False</code></pre>

-----------------------------
1] Also i have a question and it is if there will be some limitation. Because i have found out, that previous macro had limitations so i had to do more procedures (modules)
2] Second question - when i tryed to replace something like
"ELEPHANT a" with find string "ELEPHANT A" it also replaces the previous text, where A is different than a. How can i manage, that the find and replace strings will be matching the case sensitivness.

Thank you very much!!!
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,215,415
Messages
6,124,764
Members
449,187
Latest member
hermansoa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top