+ Reply to Thread
Results 1 to 4 of 4

How to sort csv file first before extracting rows of data from it

  1. #1
    Registered User
    Join Date
    04-26-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2003 2007
    Posts
    69

    How to sort csv file first before extracting rows of data from it

    I have this code that works fine before, now the source csv file data is arranged in descending order, how to add code to sort the csv file to ascending order first, before extracting the last no. rows of data,

    some csv are having header in row 1 (Date Time ......) and some don't have header, how to ignore/delete the header before applying the codes.

    How to modify the following code, thanks

    Please Login or Register  to view this content.
    Last edited by bezbid; 08-09-2015 at 01:05 AM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: How to sort csv file first before extracting rows of data from it

    Start at the bottom and fill upwards.
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-26-2014
    Location
    Singapore
    MS-Off Ver
    Excel 2003 2007
    Posts
    69

    Re: How to sort csv file first before extracting rows of data from it

    thanks for help,

    when i run the code all sheets return empty. I want to get the data of last/newest 1000 rows. not starting from 1000 row


    so i think the code would be to get the first 1000 rows now, as they are now in descending order, and then sort them to ascending order, how is the code to apply
    Last edited by bezbid; 08-09-2015 at 02:57 AM.

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: How to sort csv file first before extracting rows of data from it

    Unfortunately, since I don't know what the date format is, or where it might be in the line, I can't test for its existence. Also, I can't code for the sort because we don't have a sample file, since it seems that there might be a different number of columns in each row after the SPLIT operation.
    You could read the first 1000 lines with only one Open/read code such as:
    Please Login or Register  to view this content.

+ 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. Extracting data from one sheet to sort in another
    By Smedlex in forum Excel General
    Replies: 2
    Last Post: 03-17-2015, 12:13 AM
  2. [SOLVED] Extracting data from a CSV file
    By pernes in forum Excel General
    Replies: 4
    Last Post: 03-22-2014, 01:42 PM
  3. Extracting data from file in directory and extracting filename
    By brad999 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2014, 11:21 AM
  4. Extracting data from corrupted file
    By Merlinti in forum Excel General
    Replies: 2
    Last Post: 11-27-2013, 02:54 PM
  5. Replies: 6
    Last Post: 08-18-2012, 05:00 AM
  6. Extracting data from a text file
    By lamore48 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-19-2012, 09:53 PM
  7. Extracting Data from a .txt file
    By baby_rach in forum Access Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2010, 10:09 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