Change PivotTable Field based on Cell Value

wwebb9

New Member
Joined
Apr 3, 2013
Messages
1
I'm creating a dashboard that takes old information, moves it to the right, then refreshes the main table with information pulled from pivot tables.

My problem is, the DB is ran every month and thus the PivotTable Field 'Sum of _201301' needs to change to 'Sum of _201302' so the correct information is updated into the table. I'm not really sure the best way to proceed...


My current code for this project is:

Code:
Sub Dashboard_CU()


answer = MsgBox("Are you sure you want to run the dashboard?", vbYesNo)
If answer = vbNo Then Exit Sub
     
    Sheets("Dashboard").Range("B14:C28").Copy
    Sheets("Dashboard").Range("G14:H28").PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    
    Sheets("Dashboard").Range("B30:C50").Copy
    Sheets("Dashboard").Range("G30:H50").PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    
    Sheets("Dashboard").Range("C11").Copy
    Sheets("Dashboard").Range("H11").PasteSpecial xlPasteValues
    Application.CutCopyMode = False


    Dim pt As PivotTable
    Dim wsheet As Worksheet
     
    For Each wsheet In Worksheets
        For Each pt In wsheet.PivotTables: pt.RefreshTable: Next pt
        Next wsheet
    
End Sub
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,207,423
Messages
6,078,440
Members
446,338
Latest member
AliB

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top