View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andy Mo Andy Mo is offline
external usenet poster
 
Posts: 1
Default 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")