Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Problem with Pivot Items

Hi

I am facing a problem. I am getting the error 1004 "Unable to get data range
property of the pivot item class". My pivot has 3 column fields (or rather
pivot
items) They are - First Box, Second Box, Third Box. First Box and Second Box.
When the loop runs through First and Second Box, the program runs smoothly
because they both contain data and are visible in the pivot. However when the
loop gets to the Third Box which has no data and is not visible (it is
clicked
on the field drop down though) , I get the above error. This appears to be
self
deating as I am unable to understand what code to write that filters or
ignores
the Third Box so that I do not get this run time error.

Please help as I am unable to proceed because of this.

Thanks
Manish
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Problem with Pivot Items

Manish, Please post your code and I would be happy to help.
--
Charles Chickering

"A good example is twice the value of good advice."


"Manish Jaitly" wrote:

Hi

I am facing a problem. I am getting the error 1004 "Unable to get data range
property of the pivot item class". My pivot has 3 column fields (or rather
pivot
items) They are - First Box, Second Box, Third Box. First Box and Second Box.
When the loop runs through First and Second Box, the program runs smoothly
because they both contain data and are visible in the pivot. However when the
loop gets to the Third Box which has no data and is not visible (it is
clicked
on the field drop down though) , I get the above error. This appears to be
self
deating as I am unable to understand what code to write that filters or
ignores
the Third Box so that I do not get this run time error.

Please help as I am unable to proceed because of this.

Thanks
Manish

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Problem with Pivot Items

Thanks. Here is the code

For Each pvtitem In pvttable.PivotFields(x)).PivotItems

If (pvtitem.Name = "First Box" Or pvtitem.Name = "Second Box" Or
pvtitem.Name = "Third Box" Then

For Each c In pvtitem.DataRange ' error strikes here when the
program hits the Third Box which has no data and is not visible on the pivot.
In the drop box it is ticked. Actaully for a particualar page vale there is
no Third Box and I get this data. For other page values Third Box has values
so is visible and error does not occur.





"Charles Chickering" wrote:

Manish, Please post your code and I would be happy to help.
--
Charles Chickering

"A good example is twice the value of good advice."


"Manish Jaitly" wrote:

Hi

I am facing a problem. I am getting the error 1004 "Unable to get data range
property of the pivot item class". My pivot has 3 column fields (or rather
pivot
items) They are - First Box, Second Box, Third Box. First Box and Second Box.
When the loop runs through First and Second Box, the program runs smoothly
because they both contain data and are visible in the pivot. However when the
loop gets to the Third Box which has no data and is not visible (it is
clicked
on the field drop down though) , I get the above error. This appears to be
self
deating as I am unable to understand what code to write that filters or
ignores
the Third Box so that I do not get this run time error.

Please help as I am unable to proceed because of this.

Thanks
Manish

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Problem with Pivot Items

Manish, Try using error detecting:
On Error Resume Next
For Each c In pvtitem
If c Is Nothing Then Exit For
'Rest of Code
Next
On Error Goto 0
--
Charles Chickering

"A good example is twice the value of good advice."


"Manish Jaitly" wrote:

Thanks. Here is the code

For Each pvtitem In pvttable.PivotFields(x)).PivotItems

If (pvtitem.Name = "First Box" Or pvtitem.Name = "Second Box" Or
pvtitem.Name = "Third Box" Then

For Each c In pvtitem.DataRange ' error strikes here when the
program hits the Third Box which has no data and is not visible on the pivot.
In the drop box it is ticked. Actaully for a particualar page vale there is
no Third Box and I get this data. For other page values Third Box has values
so is visible and error does not occur.





"Charles Chickering" wrote:

Manish, Please post your code and I would be happy to help.
--
Charles Chickering

"A good example is twice the value of good advice."


"Manish Jaitly" wrote:

Hi

I am facing a problem. I am getting the error 1004 "Unable to get data range
property of the pivot item class". My pivot has 3 column fields (or rather
pivot
items) They are - First Box, Second Box, Third Box. First Box and Second Box.
When the loop runs through First and Second Box, the program runs smoothly
because they both contain data and are visible in the pivot. However when the
loop gets to the Third Box which has no data and is not visible (it is
clicked
on the field drop down though) , I get the above error. This appears to be
self
deating as I am unable to understand what code to write that filters or
ignores
the Third Box so that I do not get this run time error.

Please help as I am unable to proceed because of this.

Thanks
Manish

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
top items in a pivot by page Tuxla Excel Discussion (Misc queries) 0 October 10th 08 10:28 AM
Problem with Pivot Items Manish Jaitly Excel Programming 0 October 9th 06 03:34 PM
PROBLEM OF ADDING CALCULATED ITEMS TO PIVOT TABLE [email protected] Excel Discussion (Misc queries) 0 August 9th 06 08:37 AM
Pivot table items suepro Excel Discussion (Misc queries) 1 December 6th 05 05:01 PM
Pivot Items Pedro Excel Programming 1 December 16th 04 12:04 PM


All times are GMT +1. The time now is 01:21 PM.

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"