Pivot table filter as a combo box source

marcelo667

New Member
Joined
Aug 19, 2011
Messages
5
Hi everybody!

I´m having a huge problem with the excel. Hope you guys can help me.

My problem is that I want to use the topics of a filter in the pivot table as the source of a Combo Box.

I´ll try to exemplify that:
I have a pivot table with the filter "Citys" and then I have the options to filter: New York, Paris, London and Madrid.
My goal is to make this citys as a source to a combo box dynamicaly updated, using the VBA.

Any sugestions??
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Welcome to the Board,

Try...
Code:
Private Sub ComboBox1_DropButton_Click()
    Dim pviItem As PivotItem
    Dim pvfField As PivotField
    Dim strCurr As String
    Set pvfField = Sheets("Sheet1").PivotTables("PivotTable1") _
        .PivotFields("Citys")
    With Me.ComboBox1
        strCurr = .Value
        .Clear
        For Each pviItem In pvfField.PivotItems
             .AddItem pviItem
        Next
        .Value = strCurr
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top