[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
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
?
399 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

649 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