ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Pivot Tables by Macro (https://www.excelbanter.com/excel-worksheet-functions/242663-pivot-tables-macro.html)

Max2073

Pivot Tables by Macro
 
Hi

I have a spreadsheet with five sheets and I would like to develop a macro,
if possible that creates the pivot tables that I require.

I only want the pivot table to count. Can anyone give me a code for pivot
table macros

Column A is the Row Area
Column B is the Column Area
Column B is the Data Area

using the same data I then want to create another pivot table with
Column C as the Row Area
Column B is the Column Area
Column B is the Data Area

I would like the pivot tables to be displayed on the same sheet

Dave Peterson

Pivot Tables by Macro
 
If you record one while you do it manually, you'll have your code.

But just a suggestion...

I'd put the pivottable on its own dedicated sheet. Who knows how big the table
can grow if any of the users start to pivot it on different items???

Max2073 wrote:

Hi

I have a spreadsheet with five sheets and I would like to develop a macro,
if possible that creates the pivot tables that I require.

I only want the pivot table to count. Can anyone give me a code for pivot
table macros

Column A is the Row Area
Column B is the Column Area
Column B is the Data Area

using the same data I then want to create another pivot table with
Column C as the Row Area
Column B is the Column Area
Column B is the Data Area

I would like the pivot tables to be displayed on the same sheet


--

Dave Peterson

Max2073

Pivot Tables by Macro
 
When I record it manually and run it, I get the following

Run-time error '1004'
AddFields method of Pivot Table class failed and I am unsure how to fix this.

"Dave Peterson" wrote:

If you record one while you do it manually, you'll have your code.

But just a suggestion...

I'd put the pivottable on its own dedicated sheet. Who knows how big the table
can grow if any of the users start to pivot it on different items???

Max2073 wrote:

Hi

I have a spreadsheet with five sheets and I would like to develop a macro,
if possible that creates the pivot tables that I require.

I only want the pivot table to count. Can anyone give me a code for pivot
table macros

Column A is the Row Area
Column B is the Column Area
Column B is the Data Area

using the same data I then want to create another pivot table with
Column C as the Row Area
Column B is the Column Area
Column B is the Data Area

I would like the pivot tables to be displayed on the same sheet


--

Dave Peterson



All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com