Hi all,
I am trying to create a macro that will insert the field "Month" into the 'Axis Fields (Categories)' section on all pivot tables in my workbook. I created a dashboard that has slicers for all kinds of stuff. Now i want a button that will break down the view into months, and remove the month fields when it is clicked again.
FYI - the pivot tables are not really on the dashboard sheet, only the graphs. The pivot tables are on individually sheets which are hidden. There's like 10 of them.
Hope this makes sense!
I am trying to create a macro that will insert the field "Month" into the 'Axis Fields (Categories)' section on all pivot tables in my workbook. I created a dashboard that has slicers for all kinds of stuff. Now i want a button that will break down the view into months, and remove the month fields when it is clicked again.
FYI - the pivot tables are not really on the dashboard sheet, only the graphs. The pivot tables are on individually sheets which are hidden. There's like 10 of them.
Hope this makes sense!
Code:
Sub AddMonth()'
' AddMonth Macro
'
Dim Pvt As PivotTable
For Each Pvt In ActiveSheet
With Pvt.PivotFields("Month")
.Orientation = xlRowField
.Position = 2
End With
ActiveWorkbook.ShowPivotTableFieldList = False
End Sub