+ Reply to Thread
Results 1 to 5 of 5

Code to update Pivot selection based on other Pivot selection

  1. #1
    Registered User
    Join Date
    07-03-2019
    Location
    Stockholm, Sweden
    MS-Off Ver
    2013
    Posts
    61

    Code to update Pivot selection based on other Pivot selection

    Hi,

    I already got some help in the pivot forum but it's not working quite yet. And without any coding experience, I need support to finalise...

    I have two pivots ("PivotDetails" and "PivotSummary") where I select the year I want to analyse with the help of a slicer. I then need two other pivots ("PivotDetails_PY" and "PivotSummary_PY") to automatically select the previous year.
    I have already created a calculation in D2 showing the previous year, so D2 value should be selected as "Year" for "PivotDetails_PY" and "PivotSummary_PY".
    The worksheet is called "PIVOT".

    I got below code but a) it selects "All" years, not the value from D2 and b) I need to add the "PivotSummary_PY" to do the same.

    Maybe one issue is that the years are formatted as text in my incoming report but are a number when calculated in D2??? Unfortunately, I cannot change the incoming report without a bit of time consuming manual effort every week - which I would like to avoid. So if this is an issue, this should ideally be somehow solved in the code as well.

    Please Login or Register  to view this content.
    Can anyone help?
    Last edited by whahnelt; 10-22-2019 at 03:33 AM.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Code to update Pivot selection based on other Pivot selection

    Can you attach a short Excel sample ???
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    07-03-2019
    Location
    Stockholm, Sweden
    MS-Off Ver
    2013
    Posts
    61

    Re: Code to update Pivot selection based on other Pivot selection

    Quote Originally Posted by PCI View Post
    Can you attach a short Excel sample ???
    Hi,
    Sure, I have made a simplified version. Worksheet and pivot names as well as cell D2 containing the previous year are the same as my original file.
    So for the two lower pivots, the year should automtically be put to teh value in D2.
    Thanks!!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-03-2019
    Location
    Stockholm, Sweden
    MS-Off Ver
    2013
    Posts
    61

    Re: Code to update Pivot selection based on other Pivot selection

    Quote Originally Posted by PCI View Post
    Can you attach a short Excel sample ???
    I SOLVED IT!! With a little support from google and other forum entries I managed to understand enough to change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Then copy-pasted the section for teh second pivot - and now it's working, wohoo! :-)

    Thanks anyway!!

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Code to update Pivot selection based on other Pivot selection

    Thank you for the feed back!!!

+ 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] Pivot table field selection based on selection in other Pivot
    By whahnelt in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 10-22-2019, 04:07 AM
  2. [SOLVED] Update Pivot Table/Chart based on selection for a list box
    By cinstanl in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-23-2016, 11:58 AM
  3. [SOLVED] Adapt my current VBA Code to update pivot based selection in 2 cells
    By michelle 1 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 08-24-2015, 03:34 AM
  4. Replies: 2
    Last Post: 12-10-2014, 12:42 AM
  5. VBA code to run Multi value fields selection in Pivot table
    By Trung in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2014, 12:11 AM
  6. Pivot Table selection based on Drop Down
    By kmlloyd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2010, 10:06 AM
  7. Pivot Table selection based on Drop Down
    By kmlloyd in forum Excel General
    Replies: 1
    Last Post: 07-27-2010, 03:05 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