Sub exportfiles()
'the next line can be updated to your preferred output path
mypath = "C:\MYDIRECTORY\"
myrow = 0
For x = 1 To 100
Open mypath & x & ".csv" For Output As #1
For y = 1 To 20
myrow = myrow + 1
Print #1, Sheets(1).Cells(myrow, 1)
Next y
Close #1
Next x
MsgBox "Done"
End Sub
Replace the MYDIRECTORY part to specify the output directory. then, with you cursor somewhere in the subroutine, you can press F5 and it will run through exactly 2000 rows to create exactly 100 files with the contents of exactly 20 rows, each on a separate row.You are not logged in, either login or create an account to post comments
split -l 20 addresses.csv
there are split utilities for windows as well (e.g. this), including cygwin's. Some text editors even come with split functionality I think.
posted by idb at 3:31 PM on January 21