Find Lines in CSV file then move them in another file

bettlejus

New Member
Joined
Apr 4, 2017
Messages
32
Hi all,

I need a vbs to search a specific CSV file for lines containing words from another input txt file and then move the lines where the text was found to another CSV file of same format.

Little example:

CSV Original:

NAME , COUNTRY , DATE
name1, country1, date1
name2, country2, date2
name3, country2, date2

TXT file with search word will contain the following: "name1, name2"

I need the script to search the input CSV for those lines containing the entries from TXT and copy those line in another CSV file with same format, ex:

CSV Final:
NAME , COUNTRY , DATE
name1, country1, date1
name2, country2, date2

Any help is greatly appreciated.

Thank you!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Or an option instead of the input file for search string, those can be in excel sheet in column A and then search one by one in a CSV/TXT file and put them in another CSV/TXT file.
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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