PC Review


Reply
Thread Tools Rate Thread

Code to Check for Pivot Item

 
 
=?Utf-8?B?VC4gSmVua2lucw==?=
Guest
Posts: n/a
 
      2nd Oct 2007
I have some code that runs through a list of numbers, enters each one in a
page field of a pivot table, then extracts data from each version of that
pivot. Up until recently, this has been working well, but I now have a
situation where one of the numbers I'm using is not in the pivot field, and
Excel is doing some weird stuff by renaming the closest item to the one that
I'm trying to enter.

Bottom line is that I need some code that checks for the existence of each
number before using it as a page field. Can someone please give me some
suggestions on how to do this? I tried running through all items for the
respective pivot field, but for some reason, my simple routine (if pivot item
= my number then run routine, otherwise skip) isn't working.

Appreciate any help.

Thanks,
Todd

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      2nd Oct 2007
try this

Found = False
for each item in list
if item = Mynumber then
Found = True
exit for
end if

next item
if Found = True then
'enter your code here
else
'enter your code here
end if

"T. Jenkins" wrote:

> I have some code that runs through a list of numbers, enters each one in a
> page field of a pivot table, then extracts data from each version of that
> pivot. Up until recently, this has been working well, but I now have a
> situation where one of the numbers I'm using is not in the pivot field, and
> Excel is doing some weird stuff by renaming the closest item to the one that
> I'm trying to enter.
>
> Bottom line is that I need some code that checks for the existence of each
> number before using it as a page field. Can someone please give me some
> suggestions on how to do this? I tried running through all items for the
> respective pivot field, but for some reason, my simple routine (if pivot item
> = my number then run routine, otherwise skip) isn't working.
>
> Appreciate any help.
>
> Thanks,
> Todd
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table Pivot Item Visible - Why so difficult headly Microsoft Excel Programming 11 26th Dec 2011 12:18 PM
How to check the item in a checkedlistbox control in code? Cylix Microsoft VB .NET 1 8th Jun 2007 01:07 PM
[VBA] Check/TIck the selected Item List in Pivot Table Sphenix Microsoft Excel Programming 3 5th Feb 2007 10:01 PM
Pivot Item: removing non-existant item from the drop down =?Utf-8?B?Q2lucXVlVGVycmE=?= Microsoft Excel Programming 2 23rd Feb 2006 08:47 PM
determine cell is part of pivot item or pivot field isskiran Microsoft Excel Programming 3 8th Dec 2003 07:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:16 PM.