Closed Thread
Results 1 to 2 of 2

remove subtotals from pivot tables

  1. #1
    ChristinaC
    Guest

    remove subtotals from pivot tables

    I am trying to generate a pivot table from a set of data but I want to be
    able to run this at any time so the obvious solution would be a macro. I
    recorded the macro and checked the radio button for subtotals = none which
    brought up the following code:
    ActiveSheet.PivotTables("PivotTable5").PivotFields("Charge Week").Subtotals
    = Array(False, False, False, False, False, False, False, False, False, False,
    False, False)

    Is there a better way of doing this other than an array such as Subtotals=
    none or something like that as I assume that the array will alter depending
    on certain criteria?

  2. #2
    Tom Ogilvy
    Guest

    Re: remove subtotals from pivot tables

    Why not check out the subtotals property in help:

    Returns or sets subtotals displayed with the specified field. Valid only for
    nondata fields. Read/write Variant.

    expression.Subtotals(Index)

    expression Required. An expression that returns a PivotField object.

    Index Optional Variant. A subtotal index, as shown in the following
    table. If this argument is omitted, the Subtotals method returns an array
    that contains a Boolean value for each subtotal.

    Index Meaning
    1 Automatic
    2 Sum
    3 Count
    4 Average
    5 Max
    6 Min
    7 Product
    8 Count Nums
    9 StdDev
    10 StdDevp
    11 Var
    12 Varp


    If an index is True, the field shows that subtotal. If index 1 (Automatic)
    is True, all other values are set to False.

    ---------------------------------------------------



    So setting everything to false is the way to indicate none.



    So I wouldn't see an easier way to do it.

    --

    Regards,

    Tom Ogilvy



    "ChristinaC" <ChristinaC@discussions.microsoft.com> wrote in message
    news:262DDE5F-1CEF-43BB-AC7E-3AB4BFA7617C@microsoft.com...
    > I am trying to generate a pivot table from a set of data but I want to be
    > able to run this at any time so the obvious solution would be a macro. I
    > recorded the macro and checked the radio button for subtotals = none which
    > brought up the following code:
    > ActiveSheet.PivotTables("PivotTable5").PivotFields("Charge

    Week").Subtotals
    > = Array(False, False, False, False, False, False, False, False, False,

    False,
    > False, False)
    >
    > Is there a better way of doing this other than an array such as Subtotals=
    > none or something like that as I assume that the array will alter

    depending
    > on certain criteria?




Closed 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