?
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
Medium Priority
?
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

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

Author Comment

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

Accepted Solution

by:
terencino earned 1000 total points
ID: 38863523
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
ID: 38867589
Thank you Terry,  both for the rapidly returned worked example and encouragement!  All very much apreciated.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

771 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