C
C02C04
I'm developing a report and have put some very simple codes together. Can
someone help to simplify?
Sub refresh_Charts()
Application.ScreenUpdating = False
prog_user = Worksheets("User").Range("H10")
origin_user = Worksheets("User").Range("H11")
dest_region_user = Worksheets("User").Range("H12")
lsp_user = Worksheets("User").Range("H13")
Sheets("60D_Trend").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("Month_Trend").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("CT_60Days").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("DestMix_60D").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("User").Select
Application.ScreenUpdating = True
End Sub
someone help to simplify?
Sub refresh_Charts()
Application.ScreenUpdating = False
prog_user = Worksheets("User").Range("H10")
origin_user = Worksheets("User").Range("H11")
dest_region_user = Worksheets("User").Range("H12")
lsp_user = Worksheets("User").Range("H13")
Sheets("60D_Trend").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("Month_Trend").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("CT_60Days").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("DestMix_60D").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Program").CurrentPage =
prog_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Origin").CurrentPage
= origin_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Dest
Region").CurrentPage = dest_region_user
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("LSP").CurrentPage =
lsp_user
Sheets("User").Select
Application.ScreenUpdating = True
End Sub