ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   About PageField (https://www.excelbanter.com/excel-programming/300258-about-pagefield.html)

Polly[_3_]

About PageField
 
Does anybody know how to get the item name in the
pagefields? It seems that the following expression
doesn't work.

..PivotFields("[PageField Name]").PivotItems(i).Name
where i=1,2,3,...

Can someone give me some suggestions?

Thanks!

Best Wishes,
Polly

William[_2_]

About PageField
 
Hi Polly

Sub test()
With ActiveSheet.PivotTables("PivotTable1")
Dim i As Integer
For i = 1 To .PageFields.Count
MsgBox .PageFields(i)
Next i
End With
End Sub

--
XL2002
Regards

William



"Polly" wrote in message
...
| Does anybody know how to get the item name in the
| pagefields? It seems that the following expression
| doesn't work.
|
| .PivotFields("[PageField Name]").PivotItems(i).Name
| where i=1,2,3,...
|
| Can someone give me some suggestions?
|
| Thanks!
|
| Best Wishes,
| Polly



Debra Dalgleish

About PageField
 
The following code will list the page field items on a new worksheet:

'==============
Sub ListFields()
'lists all page field items on a new worksheet
Dim ws As Worksheet
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Dim rw As Integer
Set ws = Worksheets.Add
ws.Activate
Set pt = Worksheets("Pivot").PivotTables(1)
rw = 0
For Each pf In pt.PageFields
For Each pi In pf.PivotItems
rw = rw + 1
ws.Cells(rw, 1).Value = pi.Name
Next
Next pf
End Sub
'=====================

Polly wrote:
Does anybody know how to get the item name in the
pagefields? It seems that the following expression
doesn't work.

.PivotFields("[PageField Name]").PivotItems(i).Name
where i=1,2,3,...

Can someone give me some suggestions?

Thanks!

Best Wishes,
Polly



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


William[_2_]

About PageField
 
Hi Polly

I dont think my first post fully answered your question.

Sub test()
With ActiveSheet.PivotTables("PivotTable1")
Dim i As Integer, ii As Integer
For i = 1 To .PageFields.Count
With .PageFields(i)
For ii = 1 To .PivotItems.Count
MsgBox .PivotItems(ii)
Next ii
End With
Next i
End With
End Sub

--
XL2002
Regards

William



"Polly" wrote in message
...
| Does anybody know how to get the item name in the
| pagefields? It seems that the following expression
| doesn't work.
|
| .PivotFields("[PageField Name]").PivotItems(i).Name
| where i=1,2,3,...
|
| Can someone give me some suggestions?
|
| Thanks!
|
| Best Wishes,
| Polly



No Name

About PageField
 
Thanks for William's and Debra's reply.

I have tried both of your suggestions. However, your
codes did not work in my pivot table. If I
change "pagefields" to "rowfields" in the programs, they
both worked! I mean it can show the details of row field.
I have put a dimension in page field area and selected
five items in the dimension. Does the program not work
due to mulit-selection of items?

Best Wishes,
Polly



-----Original Message-----
Does anybody know how to get the item name in the
pagefields? It seems that the following expression
doesn't work.

..PivotFields("[PageField Name]").PivotItems(i).Name
where i=1,2,3,...

Can someone give me some suggestions?

Thanks!

Best Wishes,
Polly
.


Polly[_3_]

About PageField
 
I am using OLAP cube to create the pivot table.
Will OLAP affect the result?

Best Wishes,
Polly


-----Original Message-----
Thanks for William's and Debra's reply.

I have tried both of your suggestions. However, your
codes did not work in my pivot table. If I
change "pagefields" to "rowfields" in the programs, they
both worked! I mean it can show the details of row

field.
I have put a dimension in page field area and selected
five items in the dimension. Does the program not work
due to mulit-selection of items?

Best Wishes,
Polly



-----Original Message-----
Does anybody know how to get the item name in the
pagefields? It seems that the following expression
doesn't work.

..PivotFields("[PageField Name]").PivotItems(i).Name
where i=1,2,3,...

Can someone give me some suggestions?

Thanks!

Best Wishes,
Polly
.

.


Tom Ogilvy

About PageField
 
Try it and tell us.

--
Regards,
Tom Ogilvy

"Polly" wrote in message
...
I am using OLAP cube to create the pivot table.
Will OLAP affect the result?

Best Wishes,
Polly


-----Original Message-----
Thanks for William's and Debra's reply.

I have tried both of your suggestions. However, your
codes did not work in my pivot table. If I
change "pagefields" to "rowfields" in the programs, they
both worked! I mean it can show the details of row

field.
I have put a dimension in page field area and selected
five items in the dimension. Does the program not work
due to mulit-selection of items?

Best Wishes,
Polly



-----Original Message-----
Does anybody know how to get the item name in the
pagefields? It seems that the following expression
doesn't work.

..PivotFields("[PageField Name]").PivotItems(i).Name
where i=1,2,3,...

Can someone give me some suggestions?

Thanks!

Best Wishes,
Polly
.

.





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

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