Output VBA macro results into multiple CSV files

  • Hi All -


    I have a code that spits out the results into on large csv file. The file is over 5.2M rows and I would like to split them into multiple csv files 1M each. I don't know how to do this.


    Current code is below, can anyone assist?


  • Re: Output VBA macro results into multiple CSV files


    Hello Hoowzer,


    One suggestion as follows:
    Define variables for file sequence and row count.
    Append file sequence variable to filename
    When row count over 1,000,000 close file, increment file sequence, open new file etc.


    You may need to use "Freefile" to get an available File number (in case the #1 isn't released until macro finishes).


    Example code below (am using Excel 2000 so pardon any coding errors).


    Hope this helps,
    Pat M.


Participate now!

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