+ Reply to Thread
Results 1 to 11 of 11

file split macro help

  1. #1
    Registered User
    Join Date
    04-01-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 365
    Posts
    27

    file split macro help

    hello-

    i am being asked to split a file by supervisor name. that is to say, every time a supv's name changes in that column (column B in attached file), create a new workbook, copy and paste header rows and employee data for only that supv in this new workbook and name it after the supv's name + "salary planning". however, there is a summary table above the data set that is throwing off my ability to get this done. this summary table needs to be included in the new workbook as well. i am requesting help with this, please.

    i am also attaching the vba script i normally use for splitting files as a start, in case it is helpful. thank you in advance.

    fb

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: file split macro help

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    04-01-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 365
    Posts
    27

    Re: file split macro help

    THANK YOU for your reply.

    we're close, just a couple of hiccups. it is not giving each file a unique name. it is naming every file " Salary Planning File.xlsx", so i am getting a "this file already exists in this location, do you want to replace it?" msg when running the macro. files should be named after supv names, so "Mick Jagger Salary Planning File.xlsx", for example.

    lastly, the formulas in the summary table up top are all being returned with a #REF error after the macro is run. any tips on how to have that not happen? thank you again.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: file split macro help

    Try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-01-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 365
    Posts
    27

    Re: file split macro help

    should i delete this line of code?:
    ActiveWorkbook.SaveAs Filename:="C:\Forum Help\Mr2017\" & key & " Salary Planning File.xlsx", FileFormat:=51

    i think the formulas issue has been solved. i believe the file name issue still exists. still getting the "this file already exists in this location, do you want to replace it?" error with each file being named " Salary Planning File.xlsx".

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820
    Quote Originally Posted by fgbdrum View Post
    should i delete this line of code?:
    ActiveWorkbook.SaveAs Filename:="C:\Forum Help\Mr2017\" & key & " Salary Planning File.xlsx", FileFormat:=51

    i think the formulas issue has been solved. i believe the file name issue still exists. still getting the "this file already exists in this location, do you want to replace it?" error with each file being named " Salary Planning File.xlsx".
    My apologies. I left behind some code I was using for testing. Yes, delete that line of code and change “item” to “key” in the other line. That should fix all the problems.

  7. #7
    Registered User
    Join Date
    04-01-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 365
    Posts
    27

    Re: file split macro help

    works perfectly now. thank you so much for your time. immensely appreciated.

  8. #8
    Registered User
    Join Date
    04-01-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 365
    Posts
    27

    Re: file split macro help

    sorry, had one more question. the new files that are created after the macro has run still shows borders around the rows that are no longer populated. for example, there are 6 rows of employee data total in the file. after the macro has run, the "mick jagger" file is comprised of only 2 rows. however, the 4 unpopulated rows after that still show borders around all of the cells. are you able to add a line of code to remove those borders or simply delete the unpopulated rows? thank you so much.

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: file split macro help

    Try:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-01-2011
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 365
    Posts
    27

    Re: file split macro help

    perfection! thank you so much for everything.

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: file split macro help

    You are very welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA/macro to split an excel file into multiple files with 500 lines each
    By karambos3 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-11-2023, 12:43 PM
  2. Macro or function to split CSV file contain 2 million lines
    By is2_egypt in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-15-2016, 05:36 PM
  3. Need Macro code to split data split in 7 sheets based on variable rows in column A
    By Alija_21 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2015, 08:03 AM
  4. [SOLVED] create macro to split screen and then in top split, go to a certain cell
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-17-2015, 05:45 PM
  5. Macro to split one file into many based on criteria !!!
    By gamefreak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2015, 05:15 PM
  6. Need Macro file to split then consolidate workbooks based on partial file name
    By dawnmau in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-04-2014, 04:37 PM
  7. [SOLVED] Split Macro modification to Split into new Workbooks instead of sheets within one workbook
    By DLSmith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2012, 08:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1