Userforms, Listboxes and PivotTables - applying filters

si3po

Board Regular
Joined
Jan 7, 2019
Messages
98
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Afternoon folks,

I'm hoping somebody out there can help me with the following...

I have a multi page UserForm that each contain a ListBox that is used to display info from separate Pivot Tables. Each ListBox is populated with the following code:

Code:
Private Sub UserForm_Initialize()
 Dim pvtTable As PivotTable
 Dim vData As Variant
  
 Set pvtTable = Worksheets("SHEET NAME HERE").PivotTables(1)
 
 With pvtTable.TableRange1
   '--read data into array
   vData = .Offset(1).Resize(.Rows.count + pvtTable.ColumnGrand - 1)
 End With
  
 With Me.ListBox1
   .ColumnCount = UBound(vData, 2)
   '--transfer array values into listbox
   .List = vData
 End With

End Sub

This all works great and the ListBox on each UserForm page displays the correct information.

I'm now needing a means to apply a use selected filter to the displayed data within the ListBox. I only need apply the filter to the PivotField "Account", an as hoping that this could be accomplished using a ComboBox on the same page.

if any of you esteemed gents would be able to point me in the direction of a means to achieving this goal, I'd be incredibly obliged!
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

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