robertolux
New Member
- Joined
- Sep 20, 2012
- Messages
- 2
Hi there,
This is my first thread. I hope I post it in the right place...
In an XLS sheet I have four pivot tables, each of them having as a report filter field "Country".
I would like to include a dropdown box (combobox) in the sheet where I can select the country. Once a country has been selected, I would like Excel to automatically update the Pivot table filter of all four pivot tables to the selected country.
Although I managed to do this by creating a combobox with a related Macro (cf. main code below) I am convinced that there is a much smarter way to achieve this. Moreover, my "solution" does not enable me to use " (All) " as selection, i.e. showing all data in the pivot table.
Here is the "magic macro":
ActiveSheet.PivotTables("PivotTable1").PivotFields("Country").CurrentPage = Range("G6").Value
Cell G6 includes the selected country (i.e. result of the combobox)
Looking forward to receiving your comments.
This is my first thread. I hope I post it in the right place...
In an XLS sheet I have four pivot tables, each of them having as a report filter field "Country".
I would like to include a dropdown box (combobox) in the sheet where I can select the country. Once a country has been selected, I would like Excel to automatically update the Pivot table filter of all four pivot tables to the selected country.
Although I managed to do this by creating a combobox with a related Macro (cf. main code below) I am convinced that there is a much smarter way to achieve this. Moreover, my "solution" does not enable me to use " (All) " as selection, i.e. showing all data in the pivot table.
Here is the "magic macro":
ActiveSheet.PivotTables("PivotTable1").PivotFields("Country").CurrentPage = Range("G6").Value
Cell G6 includes the selected country (i.e. result of the combobox)
Looking forward to receiving your comments.