+ Reply to Thread
Results 1 to 8 of 8

Splitting Sheet into two Sheets using macro

  1. #1
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Splitting Sheet into two Sheets using macro

    Hi Everyone

    Thanks for looking at my post. I really appreciate it

    I am trying to save hours of work by making the following macro.

    You Start of with one Sheet called Raw_Data.

    And end up with three sheets.

    I want it to split the Raw_Data into two sheets called Raw_Sheet_1 and Raw_Sheet_2 as soon as it has passed 3 different birds.

    To make this easier to understand I have provided a final which shows what the final data should look like.
    Note that it must transfer the header to both new sheets.

    Also the number of rows can change and so can the number of columns ( hence why a macro is required ).
    So can the number of total birds.

    Note that I have attached an excel file of how the excel file should look like at the end.

    Thank you so much to everyone for looking even if you were unable to help

    Jessica
    Attached Files Attached Files

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Splitting Sheet into two Sheets using macro

    Hi Jessica,

    please use the code below - it worked fine on the example sheet you supplied.

    Please Login or Register  to view this content.
    Please click on the * below if this helps.
    Last edited by JasperD; 06-17-2013 at 09:48 AM.

  3. #3
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting Sheet into two Sheets using macro

    Hi jasper

    Thanks for all the help.

    Unfortunately, it does not seem that code works on the sample sheet.
    When i simply start with the one sheet it creates two sheets called sheet1 and sheet2 but they are empty

    Any ideas

    Am I missing something ?

    Love,

    Jessica

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Splitting Sheet into two Sheets using macro

    Make sure to put the code in the worksheet, not in a module - that should work.
    If you really want to put it in a module, then use the adjusted code below

    Please Login or Register  to view this content.
    Last edited by JasperD; 06-17-2013 at 10:00 AM.

  5. #5
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting Sheet into two Sheets using macro

    Thanks Jasper !!!!

    That works perfeclty. I can't even begin to tell you how helpful that was

    Is there a way that I could get the new sheets to be called

    chicken_1
    chicken_2

    and so on, instead of Sheet1
    Sheet2
    Sheet3 ?

    That module code just works perfectly !

  6. #6
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: Splitting Sheet into two Sheets using macro

    sure, adjust as follows :

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-11-2012
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting Sheet into two Sheets using macro

    Hi JasperD

    Thanks for all the help

    I know that now i am being difficult.

    Is it possible to write a macro which will create entirely new excel files instead of sheets ?

    And would it be possible to have a macro which would bring them back together.

    The issue is that I am running a bunch of macros in a row and eventually I get the following error message:
    "Excel cannot complete this task with available resources. Choose less data or close other applications ".

    Thanks

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Splitting Sheet into two Sheets using macro

    Your last question is a CLEAR example of "drift of topic" or "Feature creep" as it is lovingly referred to. Let's not do that.

    If that takes care of your original question in this thread, please select Thread Tools from the menu link above and mark this thread as SOLVED.
    Thanks.


    New ideas, whole new concepts even, deserve new threads. You've posited TWO whole new concepts.
    Last edited by JBeaucaire; 06-17-2013 at 10:32 AM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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