+ Reply to Thread
Results 1 to 4 of 4

Read .txt file

  1. #1
    Registered User
    Join Date
    07-21-2007
    Posts
    3

    Read .txt file

    Hello all. I initially posted a problem a few days ago, but I was advised include an actual sample file instead of a replica. Anyways, the problem is the my instrument, MS.txt, gives me my data in a format that I have to meticulously format in excel. Ideally, I'd like to extract the necessary data file MS.txt and insert it into a new worksheet, properly formatted. I included a file, IdealFile.xls, to give an example of what I'd like to have as a result.


    Key items for extraction:

    1. The "SampleID" is assigned to each data set. It appears near the top of each data set.
    2. "Analyte" is denoted by 1 or 2 letter chemical symbols.
    3. The "Mass" of analyte is to the right of the "Analyte" symbol.
    4. "Conc. Mean" is to the right of the "Mass".

    All help is greatly appreciated. Even if you can only partially solve my problem, I would be thankful. Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    See how this goes.

    Make sure your output file has sheets named Sheet2 and Sheet3.

    Please Login or Register  to view this content.

    rylo

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Te$la,

    This macro will read the text fle MS.txt and place it on the Active Worksheet starting at row 3 in columns "B" through "E". Change the file path for FileToOpen highlighted in blue.

    Please Login or Register  to view this content.
    To Install the Macro:
    1. Copy the Macro code above using CTRL+C
    2. Open Excel and Right Click on any Sheet Tab
    3. Click on View Code in the pop up menu
    4. Use ALT+I to activate the VBE Insert Menu
    5. Press the letter m to insert a Standard Module
    6. Paste the macro code using CTRL+V
    7. Save the macro using CTRL+S
    8. Close the VBE and return to excel using ALT+Q

    Sincerely,
    Leith Ross

  4. #4
    Registered User
    Join Date
    07-21-2007
    Posts
    3

    Thanks

    Thanks a lot. I'll try to get this implemented at work today.

+ 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