Unable to set orientation property in pivotfield class

N

Norm

I am having a problem setting up a pivot table. The
PivotCache has 10 fields from another worksheet. The
first 8 fields will be row fields and the last two will be
data fields. I find that I cannot set up all of the row
fields at once because once I try to set the orientation
of the second data field to "xlDataField", the macro stops
with:

"Runtime error 1004: Unable to set the orientation
property of the Pivotfield class."

So I set up 6 of the 8 row fields and then do the data
fields and at the end do the last 2 row fields. Here's
the code:

=================================
ActiveSheet.PivotTables("PivotTable1").AddFields
RowFields:=Array( _
"AcctSt", "AcctCity", "Account", "Class", "Item", "
Data")

With ActiveSheet.PivotTables("PivotTable1").PivotFields
("Units Available")
.Orientation = xlDataField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").PivotFields
("Units To Ship").Orientation = xlDataField
=================================

Then I set the last 2 row fields. This works fine on my
PC, but a different user still get the same error on the
last line of the above code.

Does anyone know why this would work on one PC and not
another with the same setup? I suspect that it will work
if I reduce the amount of row fields from 6 to perhaps 4.
Does anyone have a reason for this? Is there a better way
to set up a pivot table?

Any and all suggestions are greatly appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top