+ Reply to Thread
Results 1 to 6 of 6

extract data to a txt file

  1. #1
    Registered User
    Join Date
    06-18-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2003, Excel 2013
    Posts
    4

    extract data to a txt file

    Hello all

    I would like a macro that creates a txt file with selected data from a table. In the example i have, there is a small table in the sheet "data" (3 columns : first name, last name, points). Some lines are copied to the sheet "copysheet". The lines for which column C is = 0 must not be copied, but must end up in a log file. This log file should look like :

    These people have 0 points :
    Eve
    John

    Now for the code. I have managed to copy rows for which column C is greater than 0. I have found how to create a txt file, but my txt file only shows the forst line, and no data at all...

    Please Login or Register  to view this content.
    I guess the line that's not working is the last one of the second sub.
    Can someone tell me why?
    Last edited by AnnickW; 08-15-2013 at 12:11 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: extract data to a txt file

    attach please a sample xls file and desired text file
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    06-18-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2003, Excel 2013
    Posts
    4

    Re: extract data to a txt file

    testLog.xls
    Textfile20130814_203328.txt

    Sorry, i'm new here...
    here you are (if it worked as it should...)

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: extract data to a txt file

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-18-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2003, Excel 2013
    Posts
    4

    Re: extract data to a txt file

    Thank you very much !!!

    I had to change a thing or two : a line to make sure the LR variant is based on the data sheet even if we launch the macro while on the other one, an another to come back to the datasheet before creating the txt file.
    I also made a few other minor changes (sheet names, etc.) but i don't think it was necessary.

    Now it works fine !!!

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-18-2013
    Location
    Belgium
    MS-Off Ver
    Excel 2003, Excel 2013
    Posts
    4

    Re: extract data to a txt file

    Hum, sorry i'm back with the same question, but i realised that this solution is not going to work with the original file.
    In the original file, the data is not organised into a neat table. The ranges to be copied (or stored away in a text file) are scattered across about 100 columns and 2 different sheets. And those ranges don't have all the same size (always 1 row, but 2, 3 or 4 cells wide). That's why we use a second mini macro to select the right sheet, range and destination place.
    Unfortunately i don't have access to this file now since i'm on holiday.
    So I'm back to my original post : why can't i build up the sText string (that's going to be used in the txt file) in this mini macro?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Wanted to extract data from a file which is already an excel macro file
    By Raju Radhakrishnan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2013, 11:43 AM
  2. How to extract Information from an Excel File and entering those data in a text file?
    By bikash.nitk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-10-2012, 12:13 PM
  3. Replies: 1
    Last Post: 07-31-2011, 08:24 PM
  4. Extract data from one xls file to another
    By jguilfoyle in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-26-2009, 07:57 AM
  5. Extract data from xml file
    By ymeyaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-28-2006, 01:50 AM

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