Hi, I have basically two tabs.
- Sheet1: Has dropdown of all the managers
- Sheet2: Has a bunch of pivots (all pivots are filtered by managers)
Once you dropdown to a manager, macro will run and what it will do is change all the pivots to that person's name. Now my macro is kind of long (but it works) but it won't capture any new pivots that are going to be added in the future, so I am wanting to use Dim but unfortunately I have no VBA background and wasn't able to do this on my own and hoping someone can help me.
My code is as follow:
Sub ChangeASMs()
Sheets("Data").PivotTables("PivotTable1").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable2").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable3").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable4").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable5").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable6").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable7").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable9").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable10").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable1").PivotFields("Corp Name").AutoSort _
xlDescending, "Sum of 90 Day PVA Total"
End Sub
- Sheet1: Has dropdown of all the managers
- Sheet2: Has a bunch of pivots (all pivots are filtered by managers)
Once you dropdown to a manager, macro will run and what it will do is change all the pivots to that person's name. Now my macro is kind of long (but it works) but it won't capture any new pivots that are going to be added in the future, so I am wanting to use Dim but unfortunately I have no VBA background and wasn't able to do this on my own and hoping someone can help me.
My code is as follow:
Sub ChangeASMs()
Sheets("Data").PivotTables("PivotTable1").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable2").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable3").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable4").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable5").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable6").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable7").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable9").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable10").PivotFields("ASM").CurrentPage = _
Sheets("Dropdown").Range("I3").Value
Sheets("Data").PivotTables("PivotTable1").PivotFields("Corp Name").AutoSort _
xlDescending, "Sum of 90 Day PVA Total"
End Sub