+ Reply to Thread
Results 1 to 14 of 14

Splitting a sheet into different sheets but keeping the same format as the origional one

  1. #1
    Registered User
    Join Date
    06-26-2013
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003, 07, 10
    Posts
    92

    Splitting a sheet into different sheets but keeping the same format as the origional one

    This piece of code splits my original sheet into sections. I want to keep the same format as the original sheet has, this is to keep the border lines, the title text fo the table and the cells with no gridlines in it. See attatcehd file for the formatting.

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    Could you upload a sample workbook rather than a Word document with a picture?
    If posting code please use code tags, see here.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    Please Login or Register  to view this content.
    INTO


    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-26-2013
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003, 07, 10
    Posts
    92

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    I was just about to upload a sample Norie, but thanks anyway.

  5. #5
    Registered User
    Join Date
    06-26-2013
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003, 07, 10
    Posts
    92

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    Here is my sample sheet attatched anyway
    Attached Files Attached Files

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

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    To start change this, which actually errors anyway,
    Please Login or Register  to view this content.
    to this.
    Please Login or Register  to view this content.
    For the title and headers change this,
    Please Login or Register  to view this content.
    to this.
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    The code works as per post #3
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-26-2013
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003, 07, 10
    Posts
    92

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    I have played about with the code you have provided Norie and it brings most of the formatting over but doesn't return any values from my table, it is just a blank spreadsheet

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

    I took the original code and made all the adjustments I suggested and it worked fine.

    The only part of the formatting that wasn't brought over was removing the borders in the cells around the table.

    That could have been easily fixed by slightly adjusting the copied range and destination range.

  10. #10
    Registered User
    Join Date
    06-26-2013
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003, 07, 10
    Posts
    92

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    I was thinking the same for the borders. This code takes quite a while to process and returns blank sheets when I run it. It must just be my particular file that is causing this.

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    Does the original code work on the 'real' file?

  12. #12
    Registered User
    Join Date
    06-26-2013
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003, 07, 10
    Posts
    92

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    Sorry Norie I posted earlier but it didn't seem to go through. The code works for the real file and I have commented out the
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    part to check for any bugs. It is running a bit slower than before but that is expected as it has to put grid lines in.

  13. #13
    Registered User
    Join Date
    06-26-2013
    Location
    Northern Ireland
    MS-Off Ver
    Excel 2003, 07, 10
    Posts
    92

    Re: Splitting a sheet into different sheets but keeping the same format as the origional o

    The code seems to be printing blank sheets after a certain table is printed out with only two rows in the table, the other tables before this one are all around 20+ rows in the table

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    I don't think either of those problems are a result of the changes in the code.
    Last edited by Norie; 07-02-2013 at 11:34 AM.

+ 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