Solved

MS Excel 2007 Using a Combo Box or Index to populate Report Filters on multiple pivots on different workbooks

Posted on 2013-02-06
4
389 Views
Last Modified: 2013-02-08
Hello Experts,

I am trying to use a combo box to select the report filters on a couple of pivots.  I watched an old datapig video and have set up the combo box with a range and created an index on the ChooseName sheet in the attached workbook.  I then recorded a macro to change the report filters and am now stuck trying to edit the code.

I don't know how to make reference to the index (cell G1 on ChooseName sheet) or even whether I am using a sensible approach.

My aim is to select a name from the combo on ChooseName sheet and have wherever it says "Aldim Looret" in the code below changed to the Index name.

Can I ask for your help please.


Hello Experts,

I am trying to use a combo box to select the report filters on a couple of pivots.  I watched an old datapig video and have set up the combo box with a range and created an index on the ChooseName sheet in the attached workbook.  I then recorded a macro to change the report filters and am now stuck trying to edit the code.

I don't know how to make reference to the index (cell G1 on ChooseName sheet) or even whether I am using a sensible approach.

My aim is to select a name from the combo on ChooseName sheet and have wherever it says "Aldim Looret" in the code below changed to the Index name.

Can I ask for your help please.


Sub Macro5()
'
' Macro5 Macro
'

'
    Sheets("PivotOne").Select
    ActiveSheet.PivotTables("PivotTable1").PivotFields("Name").ClearAllFilters
    ActiveSheet.PivotTables("PivotTable1").PivotFields("Name").CurrentPage = _
        "Aldim Looret"
    ActiveSheet.PivotTables("PivotTable1").PivotFields("PursuitLead"). _
        ClearAllFilters
    ActiveSheet.PivotTables("PivotTable1").PivotFields("PursuitLead").CurrentPage _
        = "Aldim Looret"
    Sheets("PivotTwo").Select
    ActiveSheet.PivotTables("PivotTable2").PivotFields("Name").ClearAllFilters
    ActiveSheet.PivotTables("PivotTable2").PivotFields("Name").CurrentPage = _
        "Aldim Looret"
    Range("B16").Select
End Sub
0
Comment
Question by:jay0kay
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:terencino
Comment Utility
Hi jay can you attach your workbook and I'll have a look at this
...Terry
0
 

Author Comment

by:jay0kay
Comment Utility
Oops,  yep,  forgot to attach workbook.  Here it is
EE-Query.xlsx
0
 
LVL 16

Accepted Solution

by:
terencino earned 250 total points
Comment Utility
Right, this macro will run on the DropDown1_Change event. It just picks up the name from G1 in the ChooseName sheet you have already done, and applies that as a variable through the macro you recorded. You were only a step away from completing this yourself, well done! Also the file extension has to change to XLSM for it to contain macros.
...Terry
Sub DropDown1_Change()
ChooseName = Sheets("ChooseName").Range("G1").Value
With Worksheets("PivotOne").PivotTables("PivotTable1")
    .PivotFields("Name").CurrentPage = ChooseName
    .PivotFields("PursuitLead").CurrentPage = ChooseName
End With
With Worksheets("PivotTwo").PivotTables("PivotTable2")
    .PivotFields("Name").CurrentPage = ChooseName
    .PivotFields("PursuitLead").CurrentPage = ChooseName
End With
End Sub

Open in new window

EE-Query.xlsm
0
 

Author Closing Comment

by:jay0kay
Comment Utility
Thank you Terry,  both for the rapidly returned worked example and encouragement!  All very much apreciated.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is a Form List Box? (skip if you know this) The forms List Box is the alternative to the ActiveX list box. If you are using excel 2007, you first make sure you have a developer tab (click the Orb)->"Excel Options"->Popular->"Show Developer tab…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now