Results 1 to 2 of 2

Thread: find a company name in 7 different .csv files

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2012
    Posts
    1

    find a company name in 7 different .csv files

    Hi all,

    I have just started to learn VBA, but I am facing a tough challenge now. It would be really helpful, if someone could help me with this.

    I have a .xls file in which I have stored 1000 company names. The program has to take one company name at a time from the .xls file and search in 7 different .csv files. If that company name is present in any of the file then it should return yes to the column next to the company name in the .xls file, if it is not present a "no". Is this easy to do? Being a beginner I feel it is difficult. Each of the .csv file where the company name has to be searched has 60,000 rows and almost 30 columns. But only column N is required for us, as the company names will be present only in that column. Previously it was one big .csv file which had 380,000 rows. I took a code online to split them into 7 different files, as it was very slow when i operated with one big file. Earlier sometimes I even had trouble opening the file because of it size.

    Let me know if anyone could help.

    Thanks.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: find a company name in 7 different .csv files

    Is this easy to do?
    yes

    put no in next column, open each csv file (as text file) in turn, read file into variable, use instr to find company name, if found skip rest of files, put yes in next column

    without knowing file name sequence, it is not really possible to give code example
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width