+ Reply to Thread
Results 1 to 4 of 4

Looking to split up data and pivot resulting data set in one function

  1. #1
    Registered User
    Join Date
    09-26-2016
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Looking to split up data and pivot resulting data set in one function

    Hello,

    I am currently having an issue with my macro and I'm wondering if anyone on this could assist me.

    The aim is to separate a set of data by country into different workbooks, include a pivot table of the data and save each workbook individually.

    I have written two separate macros which work independently but when I try to combine the two macros the pivot part does not work.

    The issue appears to be that the pivot part of the macro does not run in the newly created workbook but in the original unfiltered workbook.

    I have attached the 2 separate macros, combined macro and sample data.

    Any help would be greatly appreciated

    RFAZ
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Looking to split up data and pivot resulting data set in one function

    I presume you don't want the people in one country to see the data for people in another country.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    09-26-2016
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    2
    Quote Originally Posted by dflak View Post
    I presume you don't want the people in one country to see the data for people in another country.
    Correct. A separate file will be sent to each country which will contain a pivot table in one tab and the raw data for that country in the other

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Looking to split up data and pivot resulting data set in one function

    This requirement is handled by pivot tables and named ranges that overlay the pivot tables. For information on named ranges, see this article:

    There is a pivot table in Column I. All I use this for is to get a unique list of names for the countries and I give the results a name “Country_List.”

    The pivot table in Columns K:P is a dump filtered for the specific country on the list. This pivot table has, in the background, data for the other countries as well.

    So, I overlay the results of this pivot table and give it a name: “Pivot_Range.”

    I use pivot name as a data source for the pivot table in Columns R:W. This pivot table looks the same as the one in the previous columns, but it does not have other country data in the background. I overlay the results of this pivot table with the name: “Pivot_Copy.”

    It is this range that I copy to the target worksheets.

    So, I go down the list in column I, cell by cell, set the pivot table filter in the first pivot table refresh the pivot tables and copy the range to the target workbook.
    Attached Files Attached Files

+ 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. Replies: 0
    Last Post: 04-01-2016, 05:41 AM
  2. Split Data with a transpose function
    By a1b2c3d4e5f6g7 in forum Excel General
    Replies: 1
    Last Post: 06-12-2014, 03:46 AM
  3. Replies: 0
    Last Post: 10-09-2013, 04:54 AM
  4. Step through rows of data resulting from a filter
    By Phil_V in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-21-2008, 11:08 AM
  5. Listboxes and resulting data
    By Warderbrad in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-09-2007, 12:46 AM
  6. showing resulting data on a another sheet
    By rekt57 in forum Excel General
    Replies: 3
    Last Post: 06-01-2007, 03:23 PM
  7. Replies: 1
    Last Post: 11-11-2005, 07:25 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