'with a user defined number (max) of lines or 'Splits a text or csv file into smaller files You can also use the macro for csv files - just replace "txt" with "csv". The new files are saved in the same folder as the original file and get the same name + a number (name1.txt, name2.txt etc.). There are probably smarter ways, but this works for me and reasonably fast. Maybe I was too impatient, but anyhow I wrote my own macro, which you can see below. I found some answers, but couldn't get them to work. ![]() So I looked for a solution that could split the log file into smaller files. These log files can be very big, and I use Excel 2003 with room for "only" 65536 rows. It started, because I wanted to analyse log files for my webpage with Excel. If your screen is small, some code lines may look broken, but they will be okay when pasted into a VBA module. ![]() You can highlight the code with the mouse, copy it by pressing CTRL+c and paste into a VBA module with CTRL+v. It also shows how to write an array to a string with linefeeds and write a file to the disk. The macro exemplifies, how the user can select a file, how the text is read into an array with one line per row with the VBA function "Split()". On this page I show how VBA can split a text file into smaller files with a user defined number of max lines/rows. Split a text file into smaller files with Excel VBA
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |