K
kittronald
I'm trying to add PivotTable fields with a macro, but it keeps coming
out as follows:
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Fruit")
.Orientation = xlRowField
.Position = 4
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Fruit")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Cost")
.Orientation = xlRowField
.Position = 5
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Cost")
.Orientation = xlRowField
.Position = 2
End With
How can I get rid of With and End With and still make it work ?
- Ronald K.
out as follows:
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Fruit")
.Orientation = xlRowField
.Position = 4
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Fruit")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Cost")
.Orientation = xlRowField
.Position = 5
End With
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Cost")
.Orientation = xlRowField
.Position = 2
End With
How can I get rid of With and End With and still make it work ?
- Ronald K.