AllisonStewart
New Member
- Joined
- Feb 24, 2017
- Messages
- 7
Hi All! First, thank you in advance for all your help. I often reference this site for my VBA/excel questions and though this is my first time posting, you all have been a tremendous help to me.
Second, I have to admit, I am a newbie at VBA. Usually, my reporting is adhoc, so I have never really needed the functionality, but I am always trying to grow and improve.
So...here goes, and hopefully I can explain this in text well enough to be understood.
I am reporting cost centre actuals in a pivot table. I have my cost centres grouped into departments (ie, HR, IT, Finance, Design, Sales, etc), and within each group there are multiple cost centres.
I have previously been able to use named ranges to filter my pivot table by individual cost centre, but I want to be able to ALSO have the ability to show all the cost centres within the group.
Below is the code I was previously working with. I was starting on the "Summary" tab and there are two data validation dropdowns. The first is to define the group, and the second is an indirect based off the first to show only the cost centres relating to the group. the second dropdown is named "costcenter"
Is there a way that in the "costcenter" range, to reference another named range with multiple values?
How would I write this?
THANK YOU SO SO MUCH!
Allison
Second, I have to admit, I am a newbie at VBA. Usually, my reporting is adhoc, so I have never really needed the functionality, but I am always trying to grow and improve.
So...here goes, and hopefully I can explain this in text well enough to be understood.
I am reporting cost centre actuals in a pivot table. I have my cost centres grouped into departments (ie, HR, IT, Finance, Design, Sales, etc), and within each group there are multiple cost centres.
I have previously been able to use named ranges to filter my pivot table by individual cost centre, but I want to be able to ALSO have the ability to show all the cost centres within the group.
Below is the code I was previously working with. I was starting on the "Summary" tab and there are two data validation dropdowns. The first is to define the group, and the second is an indirect based off the first to show only the cost centres relating to the group. the second dropdown is named "costcenter"
Code:
Sub UpdatePivot()
On Error Resume Next
Application.ScreenUpdating = False
Worksheets("Line Item Pivot").Activate
ActiveSheet.PivotTables("PivotTable1").PivotFields("Cost Center").CurrentPage = CStr(Range("costcenter"))
Worksheets("Summary").Activate
Application.ScreenUpdating = True
End Sub
Is there a way that in the "costcenter" range, to reference another named range with multiple values?
How would I write this?
THANK YOU SO SO MUCH!
Allison