Consulting

Results 1 to 8 of 8

Thread: Pivot Table Data

  1. #1

    Pivot Table Data

    Hello folks,

    I could create a pivot table if required. but you may be able to answer my query without one.

    I want to be able to double click the Grand total cell on a pivot table to open a new sheet with the data.

    Problem is as the Pivot Table Grand Total cell may move to a different cell in a column each time the data is changed.
    How to I make that Grand total Cell reference dynamic so that it locates the new cell if the data changes.

  2. #2
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Assuming a pivottable object variable pt:
        With pt.TableRange2
            .Cells(.Cells.Count).ShowDetail = True
        End With
    Be as you wish to seem

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    If there's more than one grand total at the bottom of the Values/Data area of the pivot table (but will it make any difference to the new sheet?), this will get the rightmost (or only) one:
    pt.GetPivotData(pt.DataFields(pt.DataFields.Count).Name).ShowDetail = True
    However, if there is nothing in the Values/Data area, Aflatoon's method will still work whereas mine won't!
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    Aflatoon,

    Thanks being thick here how do I set the 'pivottable object variable pt:' Also if there were more than one Pivot Table on the worksheet would it still work, the Pivot Table I'm working on is called PivtTable6.
    Last edited by LutonBarry; 03-23-2016 at 01:13 PM.

  5. #5
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Dim pt as Pivottable
    set pt = activesheet.pivottables("PivtTable6")
    for example.
    Be as you wish to seem

  6. #6
    Marvellous Aflatoon, that did do the trick. many thanks indeed. Full of admiration for you fellas I seem to get 90% there and then cannot work it out.
    Last edited by LutonBarry; 03-23-2016 at 02:47 PM.

  7. #7
    p45cal That's great it works a treat. How does it work though and suppose I wanted to take say the leftmost total?

  8. #8
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    leftmost total of the values/Data area of the pivot:
    pt.GetPivotData(pt.DataFields(1).Name).ShowDetail = True
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •