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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,224,517
Messages
6,179,233
Members
452,898
Latest member
Capolavoro009

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