View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
kittronald kittronald is offline
external usenet poster
 
Posts: 162
Default Adding PivotTable fields with a macro

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.