+ Reply to Thread
Results 1 to 2 of 2

Change Pivot tables with Macro activated by flexible entry on a Dependent Drop Down List

  1. #1
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Change Pivot tables with Macro activated by flexible entry on a Dependent Drop Down List

    Hi,

    I already created other Drop down lists that action macros depending on the month and the year.
    What the Macro basically do is the following: After I select a certain entry from the drop down list, it goes to 30 different pivot tables and changes the field to that value.

    So for example, if I choose the month “2”, this activates a Macro that goes to those 30 pivots and changes it to month “2”.
    So what I had to do was to create 12 Macros, one for each month, and then create a Private Sub Worksheet_Change in the Worksheet Module

    This is the code I am using to have the macros activated based on the year and month:
    Please Login or Register  to view this content.
    Now, this is where it gets a bit tricky for me, I have a 3rd drop down list that is based on a dependant Named range.
    This dependant Named range feeds from a pivot Table and the values on this list change depending on the year or the month I select previously,

    So the values on the drop down list change based on that info.
    Plus, there will be future new entries that are not currently present on the data at the moment so I can’t create a fixed number of Macros, like I could with the “Month” entries for example.

    What I would like to be able to do is:

    When I select an entry from this drop down list, I would like a macro to activate and change the field on those 30 Pivots, based on the entry itself, so this would be a flexible value.

    So on the Macro that changes the pivots, I can´t name the value itself, but rather the value contained on that cell.

    I hope it is clear what I am asking.
    It makes sense to me but I know that sometimes when explaining to others, it might not.

    Thank you
    If you found the solution to your question. Mark the thread as "Solved"
    Thank everyone that helped you with a valid solution by clicking on their

    There is no such thing as a problem, only a temporary lack of a solution

  2. #2
    Forum Contributor Portuga's Avatar
    Join Date
    02-20-2004
    Location
    Portugal
    MS-Off Ver
    365
    Posts
    852

    Re: Change Pivot tables with Macro activated by flexible entry on a Dependent Drop Down Li

    I managed to find a solution.
    It is actually quite simple. It´s just a small change on the code line of the Pivot table value setup:

    What I had:
    Please Login or Register  to view this content.
    The solution:
    Please Login or Register  to view this content.
    So when I change the value in cel B6, the pivot table will also change.
    This means that I only need 1 Macro to change all months and not 12 individual macros as before.

    The same principle can be applied to the Remaining drop Down lists and 1 macro per list will cover all possible values.
    Last edited by Portuga; 03-17-2013 at 07:55 PM.

+ 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