Macro Pivot Table PivotFields(-1)

JamesS

New Member
Joined
May 25, 2011
Messages
3
Hi,

I'm trying to move the values tab in the pivot table builder in to the row labels area but when i play the macro it bugs out - I think this may be the issue
Code:
PivotFields(-1)
I am having a similar issue with trying to add a percentage field as well which again I think is the same issue. I have included the extended code below.

Any help would be greatly appreciated as this is driving me mad!

Code:
Sub percentages()
'
' percentages Macro
'

'
    Range("H:H").Select
    ExecuteExcel4Macro "(""PivotTable3"",1,""Field1"",""=warranty/items"",TRUE)"
    ActiveSheet.PivotTables("PivotTable3").PivotFields("warranty%").Orientation = _
        xlDataField
    Columns("I:I").Select
    Selection.Style = "Percent"
    Range("J13").Select
End Sub






Sub movevalues()
'
' movevalues Macro
'

'
    Range("B3").Select
    With ActiveSheet.PivotTables("PivotTable3").PivotFields(-1)
        .Orientation = xlRowField
        .Position = 2
    End With
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,224,586
Messages
6,179,710
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top