ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot table selection (https://www.excelbanter.com/excel-programming/273136-pivot-table-selection.html)

John Thomas

Pivot table selection
 
Hi all,

I am using pivot tables that talkes to a OLAP cube. The sheet shows
information like this:

Project Plan
------- -----
ProjectA $200
ProjectB $300
ProjectC $500

Can I pass the project name as input to this workbook so that when this
sheet opens up it shows only one project that was requested.
Something like this:

Run excel projectinfo.xls 'projectb' , should open this excel sheet with
just "ProjectB", like this:

Project Plan
------- -----
ProjectB $300


I have this code (got from this group):

Private Sub Workbook_Open()

ActiveSheet.PivotTables("PivotTable1"). _
PivotFields("Project").CurrentPage = "ProjectB"

End Sub

My questions:
--------------
(1) This code as such doesnt work, I get a error like this:

run-time error '1004':
unable to get the pivotfields property of the pivottable class

(2) How can I pass a string to Workbook_Open() so that project that needs to
be shown is passed as a parameter ?

(3) Is there a good book by which I can learn Pivot table VBA programming ?

Thanks,
John




All times are GMT +1. The time now is 07:15 AM.

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