Split Rows Into Multiple Files

  • Hi,

    I have a large amount of data (over 50,000 rows) in a single file that I need to divide into multiple smaller files. This is a simplified version of how the main file is:-

    Field 1 ,Field 2 ,Field 3 ,Field 4
    a ,s1 ,abc , def
    b , s1 , ghk , ggh
    c , s2 , hhj , tyu
    d ,s2 , fhj , uyu
    e ,s2 ,hqj , tpu

    Based on one of the fields(say field 2), I need all the rows containing the same value of Field 2 to go to a separate file. So in the above case there will be 2 files, one containing all records with Field 2 as s1 and the other containing all records with Field 2 as s2.

    Is there any VBA code that can create the required number of files for this purpose?

    Thanks,
    Aadarsh

    :angrypc:

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!