The user has a one-column result that have an alphanumeric data with 3k rows.
The user has an application that has a limitation of processing 300 rows only, and that means the user will have 10 workbooks.
The user wants to save each workbook as a separate csv file so it can be processed much faster.
Can someone help with this?
Sub MakeCSVs() Dim a As Variant, n As Long, fi As Integer Const b = 300, f As String = "C:\temp\OutFile" fi = FreeFile With ActiveSheet a = .Range("F2:F" & CStr(.Cells(.Rows.Count, "F").End(xlUp).Row)).Value2 End With Open f & "1.csv" For Output As fi For n = 1 To UBound(a, 1) If (n - 1) Mod b = 0 Then Close fi Open f & CStr(n) & ".csv" For Output As fi End If Print #fi, a(n, 1) Next Close fi End Sub
Obtained from the OzGrid Help Forum.
Solution provided by JonathanVH.
|How to create a macro for saving copy as csv with incremental file number|