While each file is structured the same, the information within sheet 1 and 2 (for example) is different.
For column B, the function compares the row number of a cell with the total number of cells in A:B range that are not empty.
FMS Excel Merge.5.7 - Merge Excel Files, easy-to-use, merge Excel tool." ' Save in same format as original workbook veAs sFilePath "Split" sSectionName, fileFormat ' Close Set awb rent ose SaveChanges:False End Sub).Cells(1, 1).Select ' Clean up acronis true image 2013 serial a few characters to prevent invalid filename sSectionName Replace(sSectionName, " sSectionName Replace(sSectionName, " sSectionName Replace(sSectionName, " sSectionName Replace(sSectionName, " sSectionName Replace(sSectionName, " sSectionName Replace(sSectionName, ".Public Sub SplitToFiles ' macro SplitToFiles ' Last update: ' Author: mtone ' Version.1 ' Description: ' Loops through a specified column, and split each distinct values into a separate file by making a copy and deleting rows below and above ' ' Note.This macro will go through a specified column, top down, and split to a new file whenever a new value is encountered.If the result is true, the function returns the value of the cell from column A that is at row.
4 worksheets per Excel file).
' ' The following cells are ignored when delimiting sections: ' - blank cells, or containing spaces only ' - same value repeated ' - cells containing "total" ' ' Files are saved in a "Split" subfolder from the location of the source workbook, and.
The corresponding worksheets from each Excel file are named exactly the same as are the column headers.
Text sSectionName And iStartRow 0) Or InStr(1, rCell.
End If 'Turn Off Screen Updating Events Application.I have not yet extensively tested it on a variety of documents, but it works on my sample files.Cells(iRow, iCol) sCell Replace(rCell.Blanks or repeated values are kept together (as well as total rows but your column values must be sorted or unique.Dim iStopRow As Long, dim sSectionName As String ' Section name (and filename).If the result is true, the function returns a blank cell and doesn't do any more calculation.This allows to keep any printing setup, conditional formatting, charts or whatever else you might have in there, as well as keeping the header in each split file which is useful when distributing these files.If the result is false, the function moves on to the next IF statement.