Forum Discussion
Excel File Split Macro
Attached a copy of a Macro-enabled file I use to split out a master document into multiple individual workbooks. My question is for anyone familiar with Macros/VBA as I am not - I've only had this template for several years and just update the report format as need be - I would like to get the file naming portion of the routine to operate correctly.
Right now the macro sorts and filters the "Template" tab by Column A, and copies all rows with matching cell A data to a new book. Then that book is saved with a name that matches cell A exactly. I've screwed around with the VBA to try and get these to change to a concatenated name format that follows this form: YYYY-MM-DD-(Text of Cell A).xlsx
I know I can use the "Today()" function for the date, but translating this entire thing into the naming portion of the VBA is a bit above me. Suggestions anyone?
7 Replies
- DevendraJainIron Contributor
- Subodh_Tiwari_sktneerSilver Contributor
If you wish, you may directly format the date in the code instead of reading the formatted date from the cell if it is always today's date like this...
dt = Format(Date, "yyyy-mm-dd ")- JoeCavasinBrass Contributor
Thank you! the date will always be "today", works perfectly.
only other question - is it possible to have the sheet only make split copies for which there is data in column A? IE - the control sheet lists the 8 identifiers that may show up in column A, but not every run of this will have all 8 in column A. If on any given run only 2 or 3 of the identifiers are present, is it possible to have excel only split out to those two or three sheets, and not make all the other blank sheets?
Thanks