.TXT Batch replacing Macros

afzalw

New Member
Joined
Jul 24, 2012
Messages
20
I am looking for a Macro that replace my text files. It should be able to search a same work from all txt files and replace it with a different word for each file. For example I have same word "TEXT" in all my 1000 files, I want to replace this word in each file by a different word like "TEXT1" for first file, "TEXT2" for 2nd file, TEXT3" for 3rd file...."TEXT1000" for file.

I don't want to to go in each file and find this word and replace it.I have tried software like ReplaceText2.2, Power GREP, Advance Replace tools batch editing software but nothing worked for me. If anyone can help me building this Macro if its possible in excel.

I'll try to further simplify the statement.
I have 1000 files.
File 1 Search "11111" Replace it with "0.324"
File 2 Search "11111" Replace it with "0.932"
File 3 Search "11111" Replace it with "0.842"
File 4 Search "11111" Replace it with "0.642"
File 5 Search "11111" Replace it with "0.652"
.
.
.
File 1000 Search "11111" Replace it with "0.442"
Now you see all the search terms are "11111" but replace terms are different for each file.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
If it was simply a matter of incrementing a counter, you could possibly do this without a reference data file. However, your 'simplify' statement shows that it really isn't so simple. For that, you'll require a file with the replacement data strings, all in the correct order - with the corresponding filenames as well, if you need to ensure which fiile gets what revision. What do you propose to use for that?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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