View Single Post
  #3  
Old June 3rd, 2010, 07:37 AM posted to microsoft.public.excel.worksheet.functions
Roger Govier[_8_]
external usenet poster
 
Posts: 338
Default Pre-configuring Pivot table "views"

Hi Herbert
Very nice coding (as always)
However, I cannot get it to run properly.
In Sub FieldSelect, the program chokes on the line
.PivotItems(i).Visible = True
with "Error 1004 - Unable to set the visible Property of the pivot item
Class"
with the first and last item where they are Dates with the values
"1/10/2007" or "12/23/2008"
in both the Filed DDate and Years.

I can get it to run if I include an On error Resume Next
On Error Resume Next
With Sheets("PivotTable")
With .PivotTables("PivotTable1").PivotFields(fld)

and On error Goto 0 at the end of the Sub.

With Sub PageItems I get an "Error 13 Type mismatch", on the line
If .PivotItems(i).Visible Then

which I can overcome if I change the range of N to start 1 later and finish
1 earlier e.g. ignoring those 2 items in Ddate which have the "" and ""
values in their title.

For i = 2 To n - 1
If .PivotItems(i).Visible Then
s = s & ", " & .PivotItems(i).Name


I get the same result in both XL2007 and XL2010 and I cannot understand why
it is doing this.
I guess it didn't happen with you.

--

Regards
Roger Govier

"Herbert Seidenberg" wrote in message
...
Excel 2007 PivotTable
Select unique views.
With macro.
http://c0718892.cdn.cloudfiles.racks.../06_02_10.xlsm
Pdf preview:
http://www.mediafire.com/file/nmtnmzoyzrd/06_02_10.pdf



__________ Information from ESET Smart Security, version of virus
signature database 5167 (20100602) __________

The message was checked by ESET Smart Security.

http://www.eset.com




__________ Information from ESET Smart Security, version of virus signature database 5167 (20100602) __________

The message was checked by ESET Smart Security.

http://www.eset.com