+ Reply to Thread
Results 1 to 14 of 14

Split data into different worksheets in a new workbook.

  1. #1
    Registered User
    Join Date
    07-30-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    18

    Smile Split data into different worksheets in a new workbook.

    Hi all,

    I need help to write the macro for this.
    I have attached a sample report that this macro needs to be run on.
    So the macro that I need is basically look at the column I or "Store Code" heading and make a new worksheet for every different code.
    Hope this makes sense, and thank you in advance for helping!

    Kind regards,
    Felix
    Attached Files Attached Files

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Split data into different worksheets in a new workbook.

    Felix,

    This will create a worksheet for each unique value in Column I. Im not sure what your wanting to due as your creating the sheets.



    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-30-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Split data into different worksheets in a new workbook.

    thanks that worked nicely by creating the sheets.
    I also need to copy over the line of data that belongs to the store code. how do I do that?

    So basically I want to create a sheet for every single store and the data that belongs to it in that sheet.

    thanks again in advance!

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Split data into different worksheets in a new workbook.

    Here's a sample of your workbook. Use CTRL+ m to run the code


    Attachment 171361

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Split data into different worksheets in a new workbook.

    Here's the code that will do what you want


    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-30-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Split data into different worksheets in a new workbook.

    hmm it seems to always crash at the end? sorry am I not doing it correctly....so confused....

  7. #7
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Split data into different worksheets in a new workbook.

    Can you upload the workbook you are working with?

  8. #8
    Registered User
    Join Date
    07-30-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Split data into different worksheets in a new workbook.

    Here it is,

    It's rather large and this is only about half of the original size
    Attached Files Attached Files

  9. #9
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Split data into different worksheets in a new workbook.

    Attachment 171477

    @fdotlix,

    I ran the code on the workbook, how many sheets will the workbook create? It created 90 sheets. Try this workbook code. I added code to remove invalid characters from the sheet name.

  10. #10
    Registered User
    Join Date
    07-30-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Split data into different worksheets in a new workbook.

    yes there are 92 stores. when you run it did it stopped and gives an error?
    i'm starting to think that my computer doesnt have enough RAM to run macro on such big range.

    ah my bad found it ><

  11. #11
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Split data into different worksheets in a new workbook.

    @fdotlix,

    No I dont get any errors.

  12. #12
    Registered User
    Join Date
    07-30-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Split data into different worksheets in a new workbook.

    Thanks a lot Mike! the code works like a charm on Office 2010, it was because my machine was running 2003. ><
    Such a great help, really appreciated! =D

  13. #13
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Split data into different worksheets in a new workbook.

    @fdotlix,

    Dont forget to mark your post as Solved!

  14. #14
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Split data into different worksheets in a new workbook.

    @ fdotlix

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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