ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Table Macro (Show Hide) (https://www.excelbanter.com/excel-programming/374749-pivot-table-macro-show-hide.html)

Andy Mo

Pivot Table Macro (Show Hide)
 
Hi everybody,

I have pivot table with about 150 rows in each representing a course at
a college. I want to be able to show 1 of 3 faculties (arts,
humanities, Sciences) at the click of a button.

I tried recording a macro of me showing only the relevant courses, but
it only works on the sheet i recorded it on. I want it to be generic so
it will work on the active sheet. (there are 14 sheets in total)

So how would i make something like this work on any sheet (the
PivotFields("Courses") are the same throughout the workbook)

Sub tbArts()

With ActiveSheet.PivotTables("PivotTable11").PivotField s("Courses")
.PivotItems("Biology (Salters)").Visible = False
.PivotItems("Business & Finance (Applied)").Visible = False
.PivotItems("Business & Finance (VCE)").Visible = False
End With
End Sub

Ive tried clutching at straws using things like:

With ActiveSheet.PivotTables.PivotFields("Courses")

With ActiveSheet.PivotTable.PivotFields("Courses")


All times are GMT +1. The time now is 07:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com