• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

MACRO to replace pivot row field

krack1986

New Member
Hi,


I have a report where there are multiple headers and the clients want to see the data in rows as well as page. I could figure the code to use for page "ActiveSheet.PivotTables("PivotTable1").PivotFields("Site").CurrentPage = Range("U2").Value". Can anyone please help me with the code to be used when i want to replace rows? I do not want to call different subs and make a 10 page long code. Any help would be much appreciated. :)
 
Krack1986


Firstly, Welcome to the Chandoo.org forums.


It appears that you will need to add the new field and then hide the existing field

Doing something like:

[pre]
Code:
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Date")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").PivotFields("Name").Orientation = xlHidden
[/pre]

which will replace the Name field with the Date field
 
Back
Top