+ Reply to Thread
Results 1 to 5 of 5

copy pivot table to new workbook/worksheet

  1. #1
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    copy pivot table to new workbook/worksheet

    Hi,

    I'm struggling to copy a pivot table to a new workbook and worksheet. The code below creates the pivot table;

    Please Login or Register  to view this content.
    but this code is failing once it gets past the creation of new workbook/worsheet stage;

    Please Login or Register  to view this content.
    Can anyone help please?

    Thanks,

    Louise

  2. #2
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: copy pivot table to new workbook/worksheet

    Hi,

    Maybe you need to Select or Activate the sheet that has the pivot table on it? I'm looking at your code and it appears that it creates a new workbook, then adds "New Report" to cell A1 on worksheet(1), However once that is completed you are asking the script to copy from the "Activesheet"
    Please Login or Register  to view this content.
    Just a thought, Mike

  3. #3
    Forum Contributor
    Join Date
    01-23-2010
    Location
    Suffolk, England
    MS-Off Ver
    Office 365
    Posts
    271

    Re: copy pivot table to new workbook/worksheet

    Hi Mike,

    As you may have guessed I've pieced this code together from more than one source as I'm not that familiar with VBA yet.

    Please would you suggest modified coding that I could try?

    Thanks,

    Louise

  4. #4
    Registered User
    Join Date
    04-27-2011
    Location
    Lexington, Kentucky
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: copy pivot table to new workbook/worksheet

    since macros can be recorded as well as written, your easiest answer might be to turn on the record...then select the top left of the pivot table (which should select it all)...copy and paste to new workook...the resulting macro could be incorporated into your code above?

  5. #5
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388

    Re: copy pivot table to new workbook/worksheet

    add this to your code:
    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)

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