+ Reply to Thread
Results 1 to 5 of 5

Change field(s) for all Pivot Tables in active sheet

  1. #1
    Registered User
    Join Date
    03-17-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2010
    Posts
    26

    Change field(s) for all Pivot Tables in active sheet

    Hello all,

    I was wondering if anyone might direct me to some lovely VBA to do the following:

    I have several dozen (hundreds?) of pivot tables, each with three fields I will need to change.

    For example, one sheet will have lots of pivot tables with the fields "Customer ID, Monday, Tuesday, Wednesday", and the next sheet will have "Customer ID, Thursday, Friday, Saturday".

    What I'm hoping to do is copy the first sheet, and then run a macro that goes "replace Monday for Thursday, Tuesday for Friday, Wednesday for Saturday"*

    All tables would refer to the same data source.

    Any ideas on how to do this? I'm not looking forward to manually re-creating a couple hundred of these...

    Many thanks in advance for anyone who can point in the right direction!


    *(dummy data; not actually dealing with weekdays)
    Last edited by lucazzo; 05-19-2017 at 09:26 AM.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Change field(s) for all Pivot Tables in active sheet

    Hi,

    Are the fields you are trying to replace data fields, or row/column/filter fields?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    03-17-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change field(s) for all Pivot Tables in active sheet

    Only data fields (i.e: the ones that could be sum, average, count, etc).

    Row/Column/Filters remain unchanged.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Change field(s) for all Pivot Tables in active sheet

    Here is an example- change the array to match the actual field names.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-17-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Change field(s) for all Pivot Tables in active sheet

    Perfect!

    Sorry for the slow reply. I tested this throughout yesterday, and it worked like a charm. Thank you so much!

+ 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. [SOLVED] Change Report Filters for two pivot tables on the Same Sheet
    By bhenlee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2015, 04:28 PM
  2. vba code to update all pivot tables based on cell change on active sheet only
    By seatejo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2014, 08:34 PM
  3. Hiding field and part of a field in pivot tables
    By darq in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-23-2013, 02:45 PM
  4. change the value of active field in pivot table
    By phoeberunner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2011, 08:10 AM
  5. Replies: 0
    Last Post: 02-04-2010, 07:26 PM
  6. change multiple pivot tables on 1 sheet
    By tinkerbelle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2008, 06:05 AM
  7. Change pivot page field from value on other sheet
    By saskin23 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2007, 11:32 AM

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