Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Code to Check for Pivot Item

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Code to Check for Pivot Item

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
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
Check/TIck the selected Item List in Pivot Table Sphenix Excel Programming 1 February 5th 07 10:01 PM
Check/TIck the selected Item List in Pivot Table Sphenix Excel Programming 0 February 1st 07 04:41 AM
Pivot Item: removing non-existant item from the drop down CinqueTerra Excel Programming 2 February 23rd 06 08:47 PM
Menu Item check mark?? Derrick[_3_] Excel Programming 1 April 1st 05 06:36 PM
Using a Check Box as a control item Dan G Excel Discussion (Misc queries) 2 December 14th 04 07:59 PM


All times are GMT +1. The time now is 02:05 PM.

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"