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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,215,123
Messages
6,123,181
Members
449,090
Latest member
bes000

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