Adjusting PTable Positions

Joe C

Well-known Member
Joined
Oct 17, 2002
Messages
841
I was hoping to do something below to a headcount pivotable report I develped



For x = 6 To ENOPT
If IsEmpty(Cells(x, 7)) = False And IsEmpty(Cells(x, 4)) = True Then

b = ActiveSheet.PivotTables("SalTa1").PivotFields("POSN_TITLE").PivotItems( _
Cells(x, 6)).Position
ActiveSheet.PivotTables("SalTa1").PivotFields("POSN_TITLE").PivotItems( _
Cells(x, 6)).Position = b - 1
End If

Next x

But it is not working
What I want to do is
If my if statemtment triggers action I want to click on cell (x,6) and move it up one positon.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
If I just move using mouse and recorder this is the code I get


Range("F38").Select
ActiveSheet.PivotTables("SalTa1").PivotFields("POSN_TITLE").PivotItems( _
"SR. EXECUTIVE MANAGER").Position = 161

I was hoping to tell this item to be position 160


Keep in mind that SR. EXECUTIVE MANAGER itselef is not unique. Thanks for your help Andrew, and if you think I am just going the wrong way just let me know.
 
Upvote 0

Forum statistics

Threads
1,224,604
Messages
6,179,857
Members
452,948
Latest member
UsmanAli786

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