• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Create connection between Excel pivot filter and Combo box

I am facing a problem in
Create connection between Excel pivot filter and Combo box

I went through the tutorial link: http://www.datapigtechnologies.com/flashfiles/pivot10.html

The code works fine where combo box is in same sheet of pivot summary. but if i move combo box to a separate Sheet ("Dashboard"). The code is not working. I am getting error:
Runtime Error 1004: Unable to get the PivotTables property of the Worksheet class

What should i do to change the code if i want to place combo box in a separate sheet.


Please help in fixing the below code

Code:
   Sub Dealerselect()
    '
    ' vehicleandealerselect Macro
    '
 
    '
        Sheets("Pivot").Select
        ActiveSheet.PivotTables("Pivotdealer").PivotFields("BRANCH").ClearAllFilters
        ActiveSheet.PivotTables("Pivotdealer").PivotFields("BRANCH").CurrentPage = Range("BB13").Text
 
        Range("AO11").Select
    End Sub


    Sub Vehicleselect()
    '
    ' Vehicleselect Macro
    '
 
    '
        Sheets("Pivot").Select
        ActiveSheet.PivotTables("Pivotvehicle").PivotFields("BRANCH").ClearAllFilters
        ActiveSheet.PivotTables("Pivotvehicle").PivotFields("BRANCH").CurrentPage = Range("BB13").Text
        Range("BD9").Select
    End Sub
   
 
    Private Sub ComboBox1_DropButtonClick()
    Call Vehicleselect
    Call Dealerselect
    End Sub
 
Last edited by a moderator:
If the ComboBox is on Sheet1
Change the code as per below

Code:
Sub Dealerselect()
    '    Dealerselect Macro    
        ActiveSheet.PivotTables("Pivotdealer").PivotFields("BRANCH").ClearAllFilters
        ActiveSheet.PivotTables("Pivotdealer").PivotFields("BRANCH").CurrentPage = Worksheets("Sheet1").Range("BB13").Text

        Range("AO11").Select
    End Sub


Sub Vehicleselect()
    '    Vehicleselect Macro    
        ActiveSheet.PivotTables("Pivotvehicle").PivotFields("BRANCH").ClearAllFilters
        ActiveSheet.PivotTables("Pivotvehicle").PivotFields("BRANCH").CurrentPage = Worksheets("Sheet1").Range("BB13").Text
        Range("BD9").Select
    End Sub


Private Sub ComboBox1_DropButtonClick()
    Worksheets("Pivot").activate
    Call Vehicleselect
    Call Dealerselect
    End Sub
 
Back
Top