Hello everyone
This is my first post on this forum, and i would like to get some help from you
Im making a program on vba in order to control inventory, inputs and outputs, im a very beginner on VBA programming and i have a lot of doubts about the syntaxis and other stuff, but the main concern is that i would like to display specific values from a pivot table in a listbox when the user choose a combobox option, the pivot table is dynamic so the data will be changing (only rows).
The current code that im using to show data in the listbox from the pivot table (all data) is the following one (i copied from internet) *Works to show all data from the pivot table on the listbox*
--------------------------------------------------------------------------
Dim pvtTable As PivotTable
Dim vData As Variant
Set pvtTable = Worksheets("Data").PivotTables(1)
With pvtTable.TableRange1
'--read data into array
vData = .Offset(1).Resize(.Rows.Count + pvtTable.ColumnGrand - 1)
End With
With Me.lbxPedidos
.ColumnCount = UBound(vData, 2)
'--transfer array values into listbox
.List = vData
End With
--------------------------------------------------------------------------
So, my question is: is there a way to show only specific values from the pivot table on the listbox? For example:
This is the pivot table (only rows fields)
Im showing the same data on the listbox, what i want is to show only the data that belongs to the color that is choosen by the user, something like this:
If the user choose red on the combobox of the userform
Ive tried to be as clear as posible i hope that someone could help me!