+ Reply to Thread
Results 1 to 4 of 4

VBA updating SPECIFIC Pivot table with PivotTableUpdate

  1. #1
    Registered User
    Join Date
    03-31-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    5

    Question VBA updating SPECIFIC Pivot table with PivotTableUpdate

    Hi!

    In one of my worksheets I have defined two pivot tables and two XY scatter charts:

    "HD2_Pivot" and "HD2_chart"
    "HD3_Pivot" and "HD3_chart"

    I'm trying to write a VBA macro which updates one of these charts whenever the respective pivot table is changed, using the "PivotTableUpdate" function. In my macro I define following parameters:

    Set pt = PivotTables(x)
    Set cht = ChartObjects(y).Chart

    where I want to achieve the following:

    IF HD2_Pivot table is updated:
    x = "HD2_Pivot"
    y = "HD2_chart"

    ELSEIF HD3_Pivot is updated:
    x = "HD3_Pivot"
    y = "HD3_chart"

    Is there any way to know / find out which one of the two Pivot tables were updated?

    Best regards,
    David

  2. #2
    Registered User
    Join Date
    03-31-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA updating SPECIFIC Pivot table with PivotTableUpdate

    Anyone care to comment on this please?

  3. #3
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: VBA updating SPECIFIC Pivot table with PivotTableUpdate

    PivotTableUpdate event provides Target argument - this is pivot table that was changed. You may use directly in place of pvt variable you have.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  4. #4
    Registered User
    Join Date
    03-31-2016
    Location
    Stockholm, Sweden
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA updating SPECIFIC Pivot table with PivotTableUpdate

    Oh my, embarassing. As easy as that! Thanks a lot!!

+ 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] updating dynamic table from pivot table
    By Bax in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-20-2013, 06:31 AM
  2. Excel 2007 : Updating a pivot table
    By sshanku1985 in forum Excel General
    Replies: 3
    Last Post: 03-17-2011, 12:08 AM
  3. Pivot Table Not Updating
    By AnthonyWB in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-31-2011, 10:25 AM
  4. Replies: 0
    Last Post: 03-22-2009, 07:17 PM
  5. Need help updating Pivot table
    By bblevins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2008, 03:37 PM
  6. [SOLVED] updating pivot table
    By Gibran in forum Excel General
    Replies: 1
    Last Post: 10-11-2005, 06:05 PM
  7. Pivot Table updating
    By Pjcan1 in forum Excel General
    Replies: 1
    Last Post: 06-14-2005, 12:13 PM
  8. Pivot Table not Updating
    By Ranelle in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-13-2005, 12:13 PM

Tags for this Thread

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