+ Reply to Thread
Results 1 to 5 of 5

how to copy worksheet with table to new workbook... and keep table

  1. #1
    Registered User
    Join Date
    07-18-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    36

    how to copy worksheet with table to new workbook... and keep table

    I use the following code to copy a worksheet containing a table to a new workbook. The worksheet in the new workbook only contains the values and did not keep the table as a table.
    How do I get the table to be a table in the destination? The main reason is so the 'table style' applied to the table will be available when the destination workbook is exported to PDF.
    If it matters, the table is a named table populated by an xml import map. Thanks for the help.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: how to copy worksheet with table to new workbook... and keep table

    for new workbook like this


    Please Login or Register  to view this content.
    kind regards
    Leo

  3. #3
    Registered User
    Join Date
    07-18-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    36

    Re: how to copy worksheet with table to new workbook... and keep table

    Thanks Leo,
    But I see no difference in your code and mine on the copy statement. Your code also does not end up with a table on the destination worksheet. I not concerned with the full open/save Also FYI, I have found that by setting creating the destination workbook first using
    Please Login or Register  to view this content.
    doesn't keep the exact same page layout in print preview. I am not sure what causes this, but excel must be copying over some other settings related to pagelayout or printer setup, when I allow Excel to create the new workbook by using the copy function with no destination defined (line 1 of my code). I prefer and tried your way of creating the destination workbook first, then changed back to have excel automatically create the new workbook from the copy method.

  4. #4
    Registered User
    Join Date
    07-18-2014
    Location
    USA
    MS-Off Ver
    2013
    Posts
    36

    Re: how to copy worksheet with table to new workbook... and keep table

    Leo, my apologies.... After seeing no differences in the code, I decided to look deeper. By stepping through the code I found the tables were actually copied to the destination, but a later statement which I thought would only remove the formulas from all cells also caused the tables to be changed to only values (and therefore lose their alternate row style formatting). How can I remove the formulas from all the cells but keep the tables (and therefore their formatting) in place. My bad method is
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: how to copy worksheet with table to new workbook... and keep table

    Maybe like this

    Please Login or Register  to view this content.
    Kind regards
    Leo

+ 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. [Excel VBA]Copy data from a worksheet to a table on another worksheet
    By dylanrose in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2015, 04:20 AM
  2. Replies: 0
    Last Post: 01-26-2015, 05:31 PM
  3. Copy Table from one workbook to another?
    By hbs929 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-26-2014, 11:48 AM
  4. [SOLVED] Copy Table From Different Workbook
    By Gard5096 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-15-2013, 10:23 AM
  5. Replies: 1
    Last Post: 04-27-2012, 10:42 AM
  6. copy pivot table to new workbook/worksheet
    By Brontosaurus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-29-2011, 06:41 AM
  7. Copy Pivot table from one workbook into another workbook
    By karinos57 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2009, 05:07 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