jcaptchaos2
Well-known Member
- Joined
- Sep 24, 2002
- Messages
- 1,032
- Office Version
- 365
- Platform
- Windows
Hello,
I created this code so it would be easier to update these pivot tables, all I have been doing is using the replace option and changing the week number from in this case it was from 13 to 14 and it refers to the week number. I just noticed that even though all of the numbers in the pivot table showed week 14 but the data in the table was for week 13. I have the week number in the filter portion of the pivot and when I click on the drop down box I now see 14 twice in there? Hope I am explaining the issue so you understand it.
I created this code so it would be easier to update these pivot tables, all I have been doing is using the replace option and changing the week number from in this case it was from 13 to 14 and it refers to the week number. I just noticed that even though all of the numbers in the pivot table showed week 14 but the data in the table was for week 13. I have the week number in the filter portion of the pivot and when I click on the drop down box I now see 14 twice in there? Hope I am explaining the issue so you understand it.
Code:
Sub change_month_on_pivot_table()
'
' change_month_on_pivot_table Macro
'
'
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable2").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable3").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable4").PivotFields("Week").CurrentPage = "14"
Range("D13").Select
Sheets("1019 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable10").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable9").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable8").PivotFields("Week").CurrentPage = "14"
Sheets("1067 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable12").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable13").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable11").PivotFields("Week").CurrentPage = "14"
Sheets("1069 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable16").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable15").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable14").PivotFields("Week").CurrentPage = "14"
Sheets("1071 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable19").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable18").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable17").PivotFields("Week").CurrentPage = "14"
Sheets("1073 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable22").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable21").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable20").PivotFields("Week").CurrentPage = "14"
Sheets("1077 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable25").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable24").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable23").PivotFields("Week").CurrentPage = "14"
Sheets("1079 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable28").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable27").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable26").PivotFields("Week").CurrentPage = "14"
Sheets("1202 Perato").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable31").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable30").PivotFields("Week").CurrentPage = "14"
ActiveSheet.PivotTables("PivotTable29").PivotFields("Week").CurrentPage = "14"
End Sub