largeselection
Active Member
- Joined
- Aug 4, 2008
- Messages
- 358
Quick question-
I'd like to put in some code to swap the first field item in the row label section. I can do this by specifying the specific field I want to remove, but how can I get rid of the current "first field" if I don't know what it is?
So I might have my Row Labels as:
Name
State
Region
Product
I'd like to remove "Name" and add "ID" instead at the first spot. So I could do this via:
But now say I want to do the reverse?
Basically, is it possible to do something like...
to remove the first row field?
I'd like to put in some code to swap the first field item in the row label section. I can do this by specifying the specific field I want to remove, but how can I get rid of the current "first field" if I don't know what it is?
So I might have my Row Labels as:
Name
State
Region
Product
I'd like to remove "Name" and add "ID" instead at the first spot. So I could do this via:
Code:
Dim pt As PivotTable
pt.ManualUpdate = True
ActiveSheet.PivotTables("Users").PivotFields("Name").Orientation = _
xlHidden
With ActiveSheet.PivotTables("Users").PivotFields("ID")
.Orientation = xlRowField
.Position = 1
End With
But now say I want to do the reverse?
Basically, is it possible to do something like...
Code:
ActiveSheet.PivotTables("Users").PivotFields(1).Orientation = _
xlHidden
to remove the first row field?