Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting Data Field within a Pivot Table

I have a routine that checks all the names of a pivot table's dat
fields (See Below). How can I count the number of data fields withi
the For Each Loop?



Sub DisplayDataFields()
Dim x As Variant
Dim Pivot1 As PivotTable
Set Pivot1 = Worksheets("Sheet1").PivotTables("Pivot Table 1")
For Each x In Pivot1.DataFields
'Display pivot field source name (name of field in original
'data)
MsgBox "Pivotfield SourceName is " & x.SourceName
Next
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
LEB LEB is offline
external usenet poster
 
Posts: 3
Default Counting Data Field within a Pivot Table

Seems you could just DIM another as an integer:

Dim counter as integer

The increment the variable each time the loop iterates:

counter=counter+1

If you do this before the MsgBox is displayed, you could
also display the count value in the MsgBox.-----Original
Message-----
I have a routine that checks all the names of a pivot

table's data
fields (See Below). How can I count the number of data

fields within
the For Each Loop?



Sub DisplayDataFields()
Dim x As Variant
Dim Pivot1 As PivotTable
Set Pivot1 = Worksheets("Sheet1").PivotTables("Pivot

Table 1")
For Each x In Pivot1.DataFields
'Display pivot field source name (name of field in

original
'data)
MsgBox "Pivotfield SourceName is " & x.SourceName
Next
End Sub


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Counting Data Field within a Pivot Table

Thank-yo

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table Data Field ... )2 Ken Excel Discussion (Misc queries) 0 May 21st 10 07:39 PM
Pivot table field data Steve 51 Excel Discussion (Misc queries) 1 February 9th 09 08:35 PM
pivot table data field Daniel Excel Discussion (Misc queries) 3 July 4th 07 02:18 AM
use field data from 1 pivot table in another? fdibbins Excel Worksheet Functions 1 November 6th 06 06:28 PM
use field data from 1 pivot table in another? fdibbins Excel Worksheet Functions 0 November 6th 06 06:15 PM


All times are GMT +1. The time now is 05:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"