I have the below VBA code for a pivot table
This section of the code if for the rows of the Pivot Table.
What if The User had a dropdown menu and chose position 2 to be nothing(blank). As in they only wanted 1 field for the rows.
I know how to use the dim function so each of the ranges can change based on what's selected, but what if 'nothing/blank' is selected??
Any help?
Code:
'RowLabels
With ActiveSheet.PivotTables("PivotTable1").PivotFields("ProductNo")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("ProductText")
.Orientation = xlRowField
.Position = 2
End With
This section of the code if for the rows of the Pivot Table.
What if The User had a dropdown menu and chose position 2 to be nothing(blank). As in they only wanted 1 field for the rows.
I know how to use the dim function so each of the ranges can change based on what's selected, but what if 'nothing/blank' is selected??
Any help?