+ Reply to Thread
Results 1 to 5 of 5

extract specific data from a file

  1. #1
    Forum Contributor
    Join Date
    10-27-2010
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    107

    extract specific data from a file

    For this thread I would like to know once I opened a txt file instead of opening the entire contents from the file, I would like my macro to.

    Step 1:
    Look for the line that start with “subtest” and extract the word beside “subtest” and place it on column A.
    Look at the image below.
    6.JPG

    Step 2:
    Look for the line that starts with “connect”, and get the last word from the line that starts with “connect’ and place it in column B.
    Look at the image below.
    8.JPG

    Step 3:
    Do step 2 until the macro detect the line “end subtest”. Look at the image below.
    7.JPG

    Keep repeating the three steps until the end of the look at the image below
    9.JPG

    I have done step 1 and step 3 (look at my attached file). But I don’t know how to do step 2.

    The image below shows how the final outcome looks like
    http://www.iimmgg.com/image/be377ab1...faa940e850bac9

    I have attached a sample file that I need to extract
    I have attached a sample workbook
    Sheet 1 shows how the final output should look like, and also contains a button with my initial codes
    ana.zip

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: extract specific data from a file

    Please Login or Register  to view this content.



  3. #3
    Forum Contributor
    Join Date
    10-27-2010
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    107

    Re: extract specific data from a file

    Thanks snb for your help. it did extracted all the subtest except the last one. Once it goes to the last subtest the data extracted were not correct.
    Take a look at the image below.
    55.JPG

    This is how it should actually look like
    66.JPG

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: extract specific data from a file

    So dive into the code and feel free to improve it.

  5. #5
    Forum Contributor
    Join Date
    10-27-2010
    Location
    singapore
    MS-Off Ver
    Excel 2003
    Posts
    107

    Re: extract specific data from a file

    that was very helpful
    okay, i'll give it a try and see whether i can make it work.

+ 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