Amritha
Amritha

Reputation: 805

Changing Report Layout of a pivot table By Excel VBA

I am generating a pivot table using VBA in Excel. By default the Report Layout is 'Outline Form'. How can I change this to 'Compact form' or 'Tabular Form' through my code ? Any help is appreciated ! Thanks.

Upvotes: 0

Views: 11375

Answers (1)

Doug Glancy
Doug Glancy

Reputation: 27478

By running the Macro Recorder I get this code for changing it to Compact:

 ActiveSheet.PivotTables("PivotTable1").RowAxisLayout xlCompactRow

To get it into Tabular Form, sure enough:

ActiveSheet.PivotTables("PivotTable1").RowAxisLayout xlTabularRow

Remember, the Macro Recorder is your friend.

Upvotes: 3

Related Questions