I'm pretty new to VBA so I'm looking for some help on setting up a macro that will add the values from a specific range to an array and then loop through that array to update the filters on a pivot table. However not every value might be set. An example of this would be that only 4 values are set out of a 100 so it would only loop through it 4 times and update the filter with those 4 values. I have never worked with for loops before so any guidance on this would be extremely helpful.
My code so far:
Sub Update_Filters()
Dim PortfolioCodes As Variant
PortfolioCodes = Sheets("Configuration Sheet").Range("C7:C45").Value
Sheets("List").PivotTables("List").PivotFields( _
"[Portfolio].[Portfolio Code].[Portfolio Code]").VisibleItemsList = Array( _
"[Portfolio].[Portfolio Code].&[ABC1]", "[Portfolio].[Portfolio Code].&[ABC2]", _
"[Portfolio].[Portfolio Code].&[XYZ1]", "[Portfolio].[Portfolio Code].&[XYZ2]")
End Sub