+ Reply to Thread
Results 1 to 4 of 4

Use VBA to put pivot table subtotal into a variable

  1. #1
    Registered User
    Join Date
    10-27-2012
    Location
    Uk
    MS-Off Ver
    Excel 2010
    Posts
    98

    Question Use VBA to put pivot table subtotal into a variable

    Hi All

    Does anyone know if it's possible to extract a pivot table subtotal with VBA?

    I'd like to get the value 13 from the below table into a variable
    i.e where 'RESULTS' field = 'TBC'

    And it is possible, how would I handle errors if there are no TBC results in the pivot table?

    Please Login or Register  to view this content.
    Pivot Table - Bobs Jungle Gym.png

    Any advice appreciated
    All the best
    Vicky
    Last edited by vwhite; 08-20-2020 at 05:26 PM.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,985

    Re: Use VBA to put pivot table subtotal into a variable

    You can use Getpivotdata for that:

    Please Login or Register  to view this content.
    for example. Put an On Error Resume Next before it, and test the err.number if you want to know if the field isn't there.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    10-27-2012
    Location
    Uk
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Use VBA to put pivot table subtotal into a variable

    Hi Rory

    Perfect!
    You are keeping me in a job! Thank you

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,985

    Re: Use VBA to put pivot table subtotal into a variable

    Glad to help.

+ 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. pivot table subtotal
    By JesusTello in forum Excel General
    Replies: 1
    Last Post: 06-12-2017, 09:48 AM
  2. [SOLVED] pivot table subtotal
    By JesusTello in forum Excel General
    Replies: 3
    Last Post: 06-08-2017, 11:01 AM
  3. DISPLAY SUBTOTAL and SUBTOTAL % in PIVOT TABLE
    By excelmr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-11-2015, 05:44 AM
  4. [SOLVED] Add subtotal in Pivot Table
    By jewellove in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-10-2013, 09:32 PM
  5. Excel 2007 : Subtotal with Pivot Table
    By alcanel in forum Excel General
    Replies: 6
    Last Post: 09-21-2010, 05:31 AM
  6. % of subtotal in pivot table
    By JK in forum Excel General
    Replies: 1
    Last Post: 08-01-2006, 08:00 AM
  7. [SOLVED] Subtotal in a pivot table
    By MarkM in forum Excel General
    Replies: 2
    Last Post: 12-29-2005, 11:00 AM

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