ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Table Page Area selections in a macro (https://www.excelbanter.com/excel-programming/357459-pivot-table-page-area-selections-macro.html)

norrislaketn

Pivot Table Page Area selections in a macro
 
Is there an easy method to select multiple page area values to populate a
pivot table.

Example: A page area named "state" would list all 50 states but in a macro I
only want the states of Georgia and Tennessee. I do not want the user to have
to manually select. Just use a command button.

Tom Ogilvy

Pivot Table Page Area selections in a macro
 
Try doing it manually with the macro recorder turned on. That will give you
some good sample code to start with.

--
Regards,
Tom Ogilvy


"norrislaketn" wrote:

Is there an easy method to select multiple page area values to populate a
pivot table.

Example: A page area named "state" would list all 50 states but in a macro I
only want the states of Georgia and Tennessee. I do not want the user to have
to manually select. Just use a command button.


norrislaketn

Pivot Table Page Area selections in a macro
 
Tried that and also tried adding the selection manually,see below.

Sheets("Rpt").PivotTables("PivotTable1").PivotFiel ds("Area").CurrentPage =
"GEORGIA", "TENNESSEE"

It is only returning the first states data.

"Tom Ogilvy" wrote:

Try doing it manually with the macro recorder turned on. That will give you
some good sample code to start with.

--
Regards,
Tom Ogilvy


"norrislaketn" wrote:

Is there an easy method to select multiple page area values to populate a
pivot table.

Example: A page area named "state" would list all 50 states but in a macro I
only want the states of Georgia and Tennessee. I do not want the user to have
to manually select. Just use a command button.


Tom Ogilvy

Pivot Table Page Area selections in a macro
 
I couldn't record anything like that.

Are you working with OLAP data? If not, what is your data source? Excel
sheet, access database, what?

--
Regards,
Tom Ogilvy


"norrislaketn" wrote:

Tried that and also tried adding the selection manually,see below.

Sheets("Rpt").PivotTables("PivotTable1").PivotFiel ds("Area").CurrentPage =
"GEORGIA", "TENNESSEE"

It is only returning the first states data.

"Tom Ogilvy" wrote:

Try doing it manually with the macro recorder turned on. That will give you
some good sample code to start with.

--
Regards,
Tom Ogilvy


"norrislaketn" wrote:

Is there an easy method to select multiple page area values to populate a
pivot table.

Example: A page area named "state" would list all 50 states but in a macro I
only want the states of Georgia and Tennessee. I do not want the user to have
to manually select. Just use a command button.


norrislaketn

Pivot Table Page Area selections in a macro
 
SQL Server database

"Tom Ogilvy" wrote:

I couldn't record anything like that.

Are you working with OLAP data? If not, what is your data source? Excel
sheet, access database, what?

--
Regards,
Tom Ogilvy


"norrislaketn" wrote:

Tried that and also tried adding the selection manually,see below.

Sheets("Rpt").PivotTables("PivotTable1").PivotFiel ds("Area").CurrentPage =
"GEORGIA", "TENNESSEE"

It is only returning the first states data.

"Tom Ogilvy" wrote:

Try doing it manually with the macro recorder turned on. That will give you
some good sample code to start with.

--
Regards,
Tom Ogilvy


"norrislaketn" wrote:

Is there an easy method to select multiple page area values to populate a
pivot table.

Example: A page area named "state" would list all 50 states but in a macro I
only want the states of Georgia and Tennessee. I do not want the user to have
to manually select. Just use a command button.



All times are GMT +1. The time now is 06:35 PM.

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