![]() |
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.... -- jim37055 ------------------------------------------------------------------------ jim37055's Profile: http://www.excelforum.com/member.php...o&userid=27788 View this thread: http://www.excelforum.com/showthread...hreadid=493804 |
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 |
All times are GMT +1. The time now is 06:46 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com