+ Reply to Thread
Results 1 to 8 of 8

Importing Text - Specific line, stacked on a single sheet?

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    Delavan, IL
    MS-Off Ver
    Excel 2000
    Posts
    5

    Importing Text - Specific line, stacked on a single sheet?

    I've found two links that perform ALMOST what I want, but I am code illiterate, so I could use some help.

    I've got 1,500 text files, each composed of three lines, looking like this:

    %
    M029105 1638745 2 5/11/2009 94839 5.122
    %

    I am needing to import these into a single sheet, fixed width, stacking just the data from the second line. After that, I can sort as I need with the regular functions.

    Can anybody help me out here? Here's the links that are almost what I want.

    Importing Multiple Text

    Specific Line & Stacking

  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 Text - Specific line, stacked on a single sheet?

    You want the data from each file all in one cell, or parsed out to individual columns?
    _________________
    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
    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 Text - Specific line, stacked on a single sheet?

    This macro will load in all the text files in the directory noted, edit to your path where the text files are stored. It will also parse out the data to separate columns. IF you don't want that, remove the blue code noted near the bottom:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-10-2009
    Location
    Delavan, IL
    MS-Off Ver
    Excel 2000
    Posts
    5

    Re: Importing Text - Specific line, stacked on a single sheet?

    Quote Originally Posted by JBeaucaire View Post
    You want the data from each file all in one cell, or parsed out to individual columns?
    I'd like the data parsed out to individual columns, and then the data from each file to come in to the row below the previous.

    I'm going to try that script right now and see if it works like I need. Thanks for the quick response!

  5. #5
    Registered User
    Join Date
    11-10-2009
    Location
    Delavan, IL
    MS-Off Ver
    Excel 2000
    Posts
    5

    Re: Importing Text - Specific line, stacked on a single sheet?

    The code worked, except it gave me an error for the blue code. When I removed it, it imported it as I need, except each data group is in a single cell. I'm going to look at the links I posted to see if I can figure it out, but anybody who wants to beat me to it is appreciated! LOL

  6. #6
    Registered User
    Join Date
    11-10-2009
    Location
    Delavan, IL
    MS-Off Ver
    Excel 2000
    Posts
    5

    Re: Importing Text - Specific line, stacked on a single sheet?

    M029105 1638745 2 5/11/2009 94839 5.122 4.811 3.683 4.369 3.262 4.693 3.288 3.866 3.971 4.545 5.349 5.109 0.0 0.0

    Here's a full line of text, I'm not sure if that has anything to do with the arrays or not...

  7. #7
    Registered User
    Join Date
    11-10-2009
    Location
    Delavan, IL
    MS-Off Ver
    Excel 2000
    Posts
    5

    Re: Importing Text - Specific line, stacked on a single sheet?

    I just used the text to columns function to split it out, but it would be nice to have as a complete macro if somebody could help me out. Thanks!

  8. #8
    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 Text - Specific line, stacked on a single sheet?

    You're using Excel 2000, so perhaps the Text To Columns syntax I recorded is slightly different.

    Use your macro recorder to record your actions as you apply the text to columns to the column A data the macro I gave you created. Then put that recorded macro in place of the blue code originally gave you.

    Post up your version of the blue code so I can see the difference, if you don't mind.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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