+ Reply to Thread
Results 1 to 6 of 6

importing multiple text files into one worksheet and one column

  1. #1
    Registered User
    Join Date
    07-09-2008
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    91

    importing multiple text files into one worksheet and one column

    hi there,

    i read this thread and i am trying to do a very similar thing:

    http://www.excelforum.com/excel-prog...ml#post2307276

    i have many text files that need to be combined into one text file. the easiest way i can imagine is to use excel to achieve this.

    all the text files have only one column and what i want to do is import each text file, take the data and place it ALL into one column on the activesheet.

    is there a simple modification that can be done to the code in the above thread to achieve this? or is it simplier to write another vba code?

    any help would be appreciated!

    thank you very much!
    Last edited by hluk; 05-16-2010 at 10:05 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: importing multiple text files into one worksheet and one column

    Microsoft has offered a couple of ready to try solutions for merging text files.

    Check them out here.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-09-2008
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    91

    Re: importing multiple text files into one worksheet and one column

    thanks for the reply.

    the methods provided work great, however i think they work well for copying one file to another?

    i have over 30 files to combine, how should i adapt this code to load 30 text files and append them to one file?

    thank you!

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: importing multiple text files into one worksheet and one column

    Something like this I suppose:
    Please Login or Register  to view this content.

    This will open every text file in the C:\2010 folder and add it to the file C:\2010\Imported\DEST.TXT.

  5. #5
    Registered User
    Join Date
    07-09-2008
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    91

    Re: importing multiple text files into one worksheet and one column

    sweet, it works!

    the only thing is i have to use z_combined.txt as the destination file so that all the other files that starts with a 0-9 and a-y will open first.

    because the program will run and if the file is already opened, it will give an error saying "error 55, file already opened"

    small work around =)

    thanks!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: importing multiple text files into one worksheet and one column

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1