Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default counting filtered items in PivotTable

Hello all,
In VBA, I try to count the items left after filtering a PivotTable, but I
can't get it working !
Here is what I do :
a) to filter :
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").CurrentPage = "MALE"

b) to count :
MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").PivotItems.Count

The counting should differ after selecting "MALE" or "FEMALE", but still
gives me the same value, which is actually the total of both genders.

Can someone help me on this ?
Thx in advance,
Nicodemus
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default counting filtered items in PivotTable

Nic
I have run inot issues like this before it could be that the Cache is still
full
Hit the VBA help button and have a look at
MissingItemsLimit Property XlPivotTableMissingItems.
XlPivotTableMissingItems can be one of these XlPivotTableMissingItems
constants.
xlMissingItemsDefault The default number of unique items per
PivotField allowed.
xlMissingItemsMax The maximum number of unique items per PivotField
allowed (32,500).
xlMissingItemsNone No unique items per PivotField allowed (zero).

You should ensure that Missing items NONE is used

I hope this helps but it could be something else

"Nicodemus" wrote in message
...
Hello all,
In VBA, I try to count the items left after filtering a PivotTable, but I
can't get it working !
Here is what I do :
a) to filter :
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").CurrentPage = "MALE"

b) to count :
MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").PivotItems.Count

The counting should differ after selecting "MALE" or "FEMALE", but still
gives me the same value, which is actually the total of both genders.

Can someone help me on this ?
Thx in advance,
Nicodemus



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default counting filtered items in PivotTable

Hi Dude Ranch,

I tried your suggestion, but unfortunately it doesn't help...
Thx anyway.

"Dude Ranch" wrote:

Nic
I have run inot issues like this before it could be that the Cache is still
full
Hit the VBA help button and have a look at
MissingItemsLimit Property XlPivotTableMissingItems.
XlPivotTableMissingItems can be one of these XlPivotTableMissingItems
constants.
xlMissingItemsDefault The default number of unique items per
PivotField allowed.
xlMissingItemsMax The maximum number of unique items per PivotField
allowed (32,500).
xlMissingItemsNone No unique items per PivotField allowed (zero).

You should ensure that Missing items NONE is used

I hope this helps but it could be something else

"Nicodemus" wrote in message
...
Hello all,
In VBA, I try to count the items left after filtering a PivotTable, but I
can't get it working !
Here is what I do :
a) to filter :
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").CurrentPage = "MALE"

b) to count :
MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").PivotItems.Count

The counting should differ after selecting "MALE" or "FEMALE", but still
gives me the same value, which is actually the total of both genders.

Can someone help me on this ?
Thx in advance,
Nicodemus




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default counting filtered items in PivotTable

Sorry Nic - slowing down in my old age
Your answer is here

MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("Gende r").PivotItems("Male").RecordCount

This lovely piece of work will recordcount the number of Pivotitems that are
"Male" regadless of the Page setting
Not what you want but if you are hard coding as below then it is the same
result.

Aloha
Jeff



"Nicodemus" wrote in message
...
Hi Dude Ranch,

I tried your suggestion, but unfortunately it doesn't help...
Thx anyway.

"Dude Ranch" wrote:

Nic
I have run inot issues like this before it could be that the Cache is
still
full
Hit the VBA help button and have a look at
MissingItemsLimit Property XlPivotTableMissingItems.
XlPivotTableMissingItems can be one of these
XlPivotTableMissingItems
constants.
xlMissingItemsDefault The default number of unique items per
PivotField allowed.
xlMissingItemsMax The maximum number of unique items per
PivotField
allowed (32,500).
xlMissingItemsNone No unique items per PivotField allowed (zero).

You should ensure that Missing items NONE is used

I hope this helps but it could be something else

"Nicodemus" wrote in message
...
Hello all,
In VBA, I try to count the items left after filtering a PivotTable, but
I
can't get it working !
Here is what I do :
a) to filter :
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").CurrentPage =
"MALE"

b) to count :
MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").PivotItems.Count

The counting should differ after selecting "MALE" or "FEMALE", but
still
gives me the same value, which is actually the total of both genders.

Can someone help me on this ?
Thx in advance,
Nicodemus






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default counting filtered items in PivotTable

Great ! Sounds nice !
Do you perhaps know how to use 2 or more filters then ?
ie : (male) and (age 45)
Thx, Nico

"Dude Ranch" wrote:

Sorry Nic - slowing down in my old age
Your answer is here

MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("Gende r").PivotItems("Male").RecordCount

This lovely piece of work will recordcount the number of Pivotitems that are
"Male" regadless of the Page setting
Not what you want but if you are hard coding as below then it is the same
result.

Aloha
Jeff



"Nicodemus" wrote in message
...
Hi Dude Ranch,

I tried your suggestion, but unfortunately it doesn't help...
Thx anyway.

"Dude Ranch" wrote:

Nic
I have run inot issues like this before it could be that the Cache is
still
full
Hit the VBA help button and have a look at
MissingItemsLimit Property XlPivotTableMissingItems.
XlPivotTableMissingItems can be one of these
XlPivotTableMissingItems
constants.
xlMissingItemsDefault The default number of unique items per
PivotField allowed.
xlMissingItemsMax The maximum number of unique items per
PivotField
allowed (32,500).
xlMissingItemsNone No unique items per PivotField allowed (zero).

You should ensure that Missing items NONE is used

I hope this helps but it could be something else

"Nicodemus" wrote in message
...
Hello all,
In VBA, I try to count the items left after filtering a PivotTable, but
I
can't get it working !
Here is what I do :
a) to filter :
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").CurrentPage =
"MALE"

b) to count :
MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").PivotItems.Count

The counting should differ after selecting "MALE" or "FEMALE", but
still
gives me the same value, which is actually the total of both genders.

Can someone help me on this ?
Thx in advance,
Nicodemus








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default counting filtered items in PivotTable

Hello there,

I'm using another solution to count the filtered items :
I count how rows are use in the PivotTable :
MFDATE_Cnt = Cells(Cells.Rows.Count, "A").End(xlUp).Row - 6
then I deduct 6 rows :
2 rows for Filters (Gender,Age)
1 blank row
2 header rows
1 total row

This is probably not the best solution ! If someone has a better idea, I'll
be glad to hear about it.
Cheers,
Nicodemus


"Nicodemus" wrote:

Great ! Sounds nice !
Do you perhaps know how to use 2 or more filters then ?
ie : (male) and (age 45)
Thx, Nico

"Dude Ranch" wrote:

Sorry Nic - slowing down in my old age
Your answer is here

MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("Gende r").PivotItems("Male").RecordCount

This lovely piece of work will recordcount the number of Pivotitems that are
"Male" regadless of the Page setting
Not what you want but if you are hard coding as below then it is the same
result.

Aloha
Jeff



"Nicodemus" wrote in message
...
Hi Dude Ranch,

I tried your suggestion, but unfortunately it doesn't help...
Thx anyway.

"Dude Ranch" wrote:

Nic
I have run inot issues like this before it could be that the Cache is
still
full
Hit the VBA help button and have a look at
MissingItemsLimit Property XlPivotTableMissingItems.
XlPivotTableMissingItems can be one of these
XlPivotTableMissingItems
constants.
xlMissingItemsDefault The default number of unique items per
PivotField allowed.
xlMissingItemsMax The maximum number of unique items per
PivotField
allowed (32,500).
xlMissingItemsNone No unique items per PivotField allowed (zero).

You should ensure that Missing items NONE is used

I hope this helps but it could be something else

"Nicodemus" wrote in message
...
Hello all,
In VBA, I try to count the items left after filtering a PivotTable, but
I
can't get it working !
Here is what I do :
a) to filter :
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").CurrentPage =
"MALE"

b) to count :
MFDATE_Cnt =
ActiveSheet.PivotTables("myPT").PivotFields("GENDE R").PivotItems.Count

The counting should differ after selecting "MALE" or "FEMALE", but
still
gives me the same value, which is actually the total of both genders.

Can someone help me on this ?
Thx in advance,
Nicodemus






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
Excel 2007 - how to do PivotTable on filtered, visible data only? ZMAN Excel Discussion (Misc queries) 1 November 5th 09 12:06 AM
items filtered roxanne Excel Discussion (Misc queries) 2 October 15th 07 03:52 PM
PivotTable: Difference from Row Items astrodon Excel Discussion (Misc queries) 1 February 22nd 06 03:13 PM
counting filtered items mar10 Excel Worksheet Functions 3 August 25th 05 08:09 PM
pivotTable and filtered list No Name Excel Programming 1 October 22nd 03 03:31 AM


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

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

About Us

"It's about Microsoft Excel"