Hello/Thanks In Advance.
I am trying to find a way to loop thru column headers so that I can use what is found in VBA code to sort into a Pivot Table.
Column headers could be a number of Age combinations:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]P 18-24 Boys[/TD]
[TD]P 25-54 Boys[/TD]
[/TR]
</tbody>[/TABLE]
For example, I want to take any column header that contains text *Boys* - and do the below for me:
With ActiveSheet.PivotTables("PivotTable1").PivotFields("P 18-24 Boys")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("P 25-54 Boys")
.Orientation = xlPageField
.Position = 1
End With
Thanks
Cathy
I am trying to find a way to loop thru column headers so that I can use what is found in VBA code to sort into a Pivot Table.
Column headers could be a number of Age combinations:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]P 18-24 Boys[/TD]
[TD]P 25-54 Boys[/TD]
[/TR]
</tbody>[/TABLE]
For example, I want to take any column header that contains text *Boys* - and do the below for me:
With ActiveSheet.PivotTables("PivotTable1").PivotFields("P 18-24 Boys")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("P 25-54 Boys")
.Orientation = xlPageField
.Position = 1
End With
Thanks
Cathy