Find & Replace VBA - read txt in cell in column A, find if same exists in any cell in column C, replace it with txt found in adjacent cell in column B

abramo

New Member
Joined
May 14, 2013
Messages
37
In past had found solution to issue, requested by another member and published in mrexcel, but I cannot locate it any more. So here is my request for Macro:

Find & Replace macro :
EVERYTHING IS IN A SINGLE SHEET

- read txt in cell in column A
- find if same txt exists in *any* cell in column D (loop all D)
- write new txt in cell in column C euqal to txt found in cell in B which is adjacent to our cell in column A (pairs A / B contain FIND (A) and REPLACE BY (B)
- repeat by next cell in column A
- end when ALL cells in column A have been dealt with

MREXCEL-find-replace-2023-03-23-A.xlsx
ABCD
1CATEGORY-ORIGINALCategory-processedCategory-processedCATEGORY-ORIGINAL
2Compressors, Air Tanks & Pneumatic Tools > Air and Water AftercoolersCompressor Air & Water AftercoolersCompressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
3Compressors, Air Tanks & Pneumatic Tools > Air Compressor AccessoriesAir Compressor AccessoriesCompressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
4Compressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator KitsAir Compressor Separator KitsCompressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
5Compressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts KitsAir Compressor Parts KitsCompressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
6Compressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air TanksAir Compressor Portable Air TanksCompressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
7Compressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
8Compressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
9Compressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
10Compressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
11Compressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
12Compressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
13Compressor Air & Water AftercoolersCompressors, Air Tanks & Pneumatic Tools > Air and Water Aftercoolers
14Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
15Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
16Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
17Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
18Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
19Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
20Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
21Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
22Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
23Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
24Air Compressor AccessoriesCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories
25Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
26Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
27Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
28Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
29Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
30Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
31Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
32Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
33Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
34Air Compressor Separator KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Compressor Separator Kits
35Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
36Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
37Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
38Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
39Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
40Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
41Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
42Air Compressor Parts KitsCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Parts Kits
43Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
44Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
45Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
46Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
47Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
48Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
49Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
50Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
51Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
52Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
53Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
54Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
55Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
56Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
57Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
58Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
59Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
60Air Compressor Portable Air TanksCompressors, Air Tanks & Pneumatic Tools > Air Compressor Accessories > Portable Air Tanks
Sheet1


Explanation of example:
Columns A and B contain the pairs of FIND (col A) and REPLACE BY (col B)
Column D contains the original texts to be replaced
Column C contains the end result provided by the Find & Replace process

Hope some kindred spirit may assist here.
Thanks!

PS: OUCH : title of thread wrong! Should read:
Find & Replace VBA - read txt in cell in column A, find if same exists in any cell in column D, replace it in C with txt found in adjacent cell in column B
 
Ok, at least it is a start. Keep me posted. We will get through the issues.

Have a nice night.
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Good news @igold > tried code in alternative environment and, lo & behold, it functions 100% as advertised. Now I have to find out what may be the issue with my original environment.

No words can describe my joy (a bit of exaggeration is certainly called for here)!
Honestly, thanks for your speedy and helpful attitude, much appreciated.
Have a nice weekend!

 
Upvote 0
I was happy to help- I am glad you got it squared away. Thanks for the feedback!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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