+ Reply to Thread
Results 1 to 13 of 13

splitting excel workbook into seperate sheets depending on number of rows

  1. #1
    Registered User
    Join Date
    12-26-2012
    Location
    turkey
    MS-Off Ver
    Excel 2003
    Posts
    6

    Red face splitting excel workbook into seperate sheets depending on number of rows

    Hello,
    I have an excel workbook with over 40k rows with first 7 rows that as header. I would like to have a macro that divides this data into seperate worksheets. Details are:
    1)Each worksheet should have 35 rows of data from first worksheet and header (first 7 rows in the first raw data sheet)
    2) First raw data sheet should stay as it is
    3)other worksheets should be named 1,2,3,4 ..etc
    4)macro should stop when there all data is copied to different worksheets.

    I really appreciate your help

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: splitting excel workbook into seperate sheets depending on number of rows

    Try this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: splitting excel workbook into seperate sheets depending on number of rows

    You're going to have somewhere around 1150 sheets added!!!!


    Please Login or Register  to view this content.
    Last edited by jolivanes; 12-26-2012 at 03:39 PM.

  4. #4
    Registered User
    Join Date
    12-26-2012
    Location
    turkey
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: splitting excel workbook into seperate sheets depending on number of rows

    Thanks, but it is not working. I run it just like the other macros in the document but it does not do anything

  5. #5
    Registered User
    Join Date
    12-26-2012
    Location
    turkey
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: splitting excel workbook into seperate sheets depending on number of rows

    thanks, but this only creates one worksheet,renames it but there is no data in it

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: splitting excel workbook into seperate sheets depending on number of rows

    Both Norie's and mine work in a trial workbook. Mind you, I only tried with just over 4,000 entries, not 40,000 but that should not differ.

  7. #7
    Registered User
    Join Date
    12-26-2012
    Location
    turkey
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: splitting excel workbook into seperate sheets depending on number of rows

    Hi, could you please attach the trial workbook? thx

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    Could you attach a sample workbook?

  9. #9
    Registered User
    Join Date
    12-26-2012
    Location
    turkey
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: splitting excel workbook into seperate sheets depending on number of rows

    here is the sample file, I reduced the number or rows
    Attached Files Attached Files

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: splitting excel workbook into seperate sheets depending on number of rows

    There's no data in column A.

    One simple change is needed in the code I posted.
    Please Login or Register  to view this content.
    I'm sure there'll be a similarly simple fix for jolivanes' code.

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: splitting excel workbook into seperate sheets depending on number of rows

    As Norie mentioned, a minor tweak.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    12-26-2012
    Location
    turkey
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: splitting excel workbook into seperate sheets depending on number of rows

    Many thanks to both, its now working perfectly I just have one more issue to tackle and would really appreciate your help on it. After splitting I need to sum the balance and write it on the sheet and also to the next sheet.How can I do it with a macro?
    Here are the details.
    Go to sheet "1"
    Copy the number in G44
    Go to next sheet (sheet "2")
    Paste as values to cell G45
    This should go on until sheets end.
    Thanks again

  13. #13
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: splitting excel workbook into seperate sheets depending on number of rows

    If the balance is in Column G, the this might do it.
    Try it on a copy of your workbook please.



    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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