+ Reply to Thread
Results 1 to 2 of 2

Need pivot table to automatically highlight subtotal rows

  1. #1
    Registered User
    Join Date
    10-04-2005
    Posts
    11

    Need pivot table to automatically highlight subtotal rows

    I have a macro set up that creates a very generic looking pivot table, and I would like it to be able to automatically highlight the subtotal rows in yellow. Any ideas out there on how this is done. I am guessing that there is a simple solution to this, but I am having a brain fart right now....

  2. #2
    Philip
    Guest

    RE: Need pivot table to automatically highlight subtotal rows

    You need to look into the object model of the Pivot Table.

    here is a snippet from what we did:

    CODE>>>
    With xlWorksheet.PivotTables("Statistics")

    ' sort the status codes...
    .PivotFields("Status Code").AutoSort xlAscending, "Status Code"

    .PivotSelect "'No. Of Items'", xlDataAndLabel
    xlApplication.Selection.Interior.ColorIndex = 19

    ' format the 'Shares' count column
    .PivotSelect "'No. Of Items'", xlDataOnly
    xlApplication.Selection.NumberFormat = "#,##0_);(#,##0)"

    <<< END

    Te best way to start is to turn on the macro recorder, right-click the pivot
    table on the field you want rto change, and choose format cells, see if that
    helps.

    As you can see from the code above, you reference the table, then in that
    table, you have a collection of PivotItems and PivotFields which you can
    refererence and manipulate...

    HTH

    Philip
    "jim37055" wrote:

    >
    > I have a macro set up that creates a very generic looking pivot table,
    > and I would like it to be able to automatically highlight the subtotal
    > rows in yellow. Any ideas out there on how this is done. I am
    > guessing that there is a simple solution to this, but I am having a
    > brain fart right now....
    >
    >
    > --
    > jim37055
    > ------------------------------------------------------------------------
    > jim37055's Profile: http://www.excelforum.com/member.php...o&userid=27788
    > View this thread: http://www.excelforum.com/showthread...hreadid=493804
    >
    >


+ 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