How to split Excel worksheet into multiple files?

%3CLINGO-SUB%20id%3D%22lingo-sub-1152971%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20split%20Excel%20worksheet%20into%20multiple%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1152971%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F546061%22%20target%3D%22_blank%22%3E%40VBA_Newbie%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20qualified%20to%20directly%20answer%26nbsp%3B%20your%20question%20regarding%20VBA%20and%20its%20use%20in%20dividing%20your%20worksheet%20up.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20qualified%20to%20ask%20you%20%22Why%3F%22%20And%20I%20do%20that%20not%20just%20to%20be%20a%20pain%20in%20the%20neck%3B%20rather%2C%20although%20I%20fully%20recognize%20there%20may%20be%20fully%20justifiable%20reasons%2C%20I%20also%20am%20a%20defender%20of%20the%20power%20of%20Excel%20to%20work%20with%20large%20databases%2C%20using%20such%20things%20as%20dates--the%20basis%20for%20your%20desired%20splitting--as%20the%20basis%20for%20looking%20at%20and%20analyzing%20effectively%20subsets%20within%20that%20whole.%20Breaking%20it%20apart%2C%20on%20the%20other%20hand%2C%20makes%20it%20more%20difficult%20to%20do%20%3CSTRONG%3Eoverall%3C%2FSTRONG%3E%20or%20all-encompassing%20analysis%2C%20which%20you%20also%20might%20want%20to%20do.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20you%20begin%20your%20posting%20with%20this%20statement%2C%20%22I%20%3CU%3E%3CEM%3Eneed%3C%2FEM%3E%3C%2FU%3E%20to%20split%20a%20worksheet%20with%2010%2C000%20rows%20into%20multiple%20Excel%20files%20based%20on%20the%20dates%20in%20column%20D%2C%22%20and%20I%20just%20am%20asking%20whether%20you%20really%20NEED%20to%20do%20that.%20You%20give%20no%20reason.%20As%20I%20said%2C%20there%20may%20be%20a%20perfectly%20valid%20reason.%20But%20in%20general--for%20others%20who%20come%20here%20to%20the%20%3CSTRONG%3Etechcommunity%3C%2FSTRONG%3E%20site%20with%20workbooks%20consisting%20of%20monthly%20or%20yearly%20sheets--you'll%20see%20many%20a%20recommendation%20to%20first%20consolidate%20those%20separated%20sheets%20into%20one%20so%20as%20to%20be%20able%20to%20accomplish%20the%20all-encompassing%20analysis%20they're%20trying%20to%20accomplish.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1153038%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20split%20Excel%20worksheet%20into%20multiple%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1153038%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F546061%22%20target%3D%22_blank%22%3E%40VBA_Newbie%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20you%20upload%20a%20sample%20file%20to%20work%20with%20and%20another%20file%20which%20shows%20the%20desired%20output%20you%20are%20trying%20to%20achieve%3F%3C%2FP%3E%3CP%3EDo%20you%20want%20to%20run%20the%20macro%20from%20Excel%20itself%20or%20from%20another%20application%20like%20Access%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1152816%22%20slang%3D%22en-US%22%3EHow%20to%20split%20Excel%20worksheet%20into%20multiple%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1152816%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EHow%20do%20I%20split%20an%20Excel%20worksheet%20with%2010%2C000%2B%20rows%20into%20multiple%20Excel%20files%20based%20on%20the%20values%20in%20column%20D%20via%20a%20Macro%2FVBA%3F%20The%20file%20has%209%20columns%20(A%3AI)%2C%20I%20also%20need%20the%20split%20files%20to%20automatically%20save%20in%20a%20specified%20folder.%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%26nbsp%3B%3C%2FPRE%3E%3CDIV%20class%3D%22post-taglist%20grid%20gs4%20gsy%20fd-column%22%3E%3CDIV%20class%3D%22grid%20ps-relative%20d-block%22%3E-ERR%3AREF-NOT-FOUND-microsoft-excel%20-ERR%3AREF-NOT-FOUND-vba%20-ERR%3AREF-NOT-FOUND-macros%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1152816%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMacros%20and%20VBA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1760447%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20split%20Excel%20worksheet%20into%20multiple%20files%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1760447%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3BNot%20sure%20about%20the%20poster%2C%20but%20I've%20had%20to%20do%20this%20so%20I%20can%20create%20individual%20spreadsheets%20for%20multiple%20individuals.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%20I%20have%20a%20mass%20spreadsheet%20of%20associates%20that%20need%20to%20have%20some%20kind%20of%20change%20recorded%2C%20but%20the%20associates%20are%20managed%20by%20all%20different%20people%2C%20so%20I%20want%20to%20send%20each%20supervisor%2C%20which%20would%20be%20a%20column%20on%20the%20spreadsheet%2C%20their%20own%20spreadsheet%20with%20only%20the%20associates%20they%20are%20responsible%20for.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20may%20be%20to%20keep%20things%20simple%20or%20due%20to%20the%20fact%20that%20the%20data%20may%20contain%20some%20sensitive%20items%20that%20we%20don't%20want%20everyone%20to%20see.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E365%20seems%20to%20be%20reacting%20a%20bit%20different%20from%20the%20old%20VB%20scripts%20I%20had.%26nbsp%3B%20For%20example%201%20script%20that%20used%20to%20split%20the%20sheet%20into%20multiple%20tabs%2Fworksheets%2C%20creates%20the%20proper%20tabs%2C%20but%20no%20longer%20seems%20to%20move%20the%20actual%20data%20over.%26nbsp%3B%20Usually%20I'd%20move%20the%20master%20to%20worksheets%2C%20validate%20and%20then%20move%20the%20sheets%20to%20their%20own%20files.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi,

How do I split an Excel worksheet with 10,000+ rows into multiple Excel files based on the values in column D via a Macro/VBA? The file has 9 columns (A:I), I also need the split files to automatically save in a specified folder.

Thanks!

 

 
3 Replies

@VBA_Newbie 

 

I'm not qualified to directly answer  your question regarding VBA and its use in dividing your worksheet up.

 

I am qualified to ask you "Why?" And I do that not just to be a pain in the neck; rather, although I fully recognize there may be fully justifiable reasons, I also am a defender of the power of Excel to work with large databases, using such things as dates--the basis for your desired splitting--as the basis for looking at and analyzing effectively subsets within that whole. Breaking it apart, on the other hand, makes it more difficult to do overall or all-encompassing analysis, which you also might want to do.

 

So you begin your posting with this statement, "I need to split a worksheet with 10,000 rows into multiple Excel files based on the dates in column D," and I just am asking whether you really NEED to do that. You give no reason. As I said, there may be a perfectly valid reason. But in general--for others who come here to the techcommunity site with workbooks consisting of monthly or yearly sheets--you'll see many a recommendation to first consolidate those separated sheets into one so as to be able to accomplish the all-encompassing analysis they're trying to accomplish.

@VBA_Newbie 

Can you upload a sample file to work with and another file which shows the desired output you are trying to achieve?

Do you want to run the macro from Excel itself or from another application like Access?

@mathetes Not sure about the poster, but I've had to do this so I can create individual spreadsheets for multiple individuals.

 

For example I have a mass spreadsheet of associates that need to have some kind of change recorded, but the associates are managed by all different people, so I want to send each supervisor, which would be a column on the spreadsheet, their own spreadsheet with only the associates they are responsible for.

 

This may be to keep things simple or due to the fact that the data may contain some sensitive items that we don't want everyone to see.

 

365 seems to be reacting a bit different from the old VB scripts I had.  For example 1 script that used to split the sheet into multiple tabs/worksheets, creates the proper tabs, but no longer seems to move the actual data over.  Usually I'd move the master to worksheets, validate and then move the sheets to their own files.