ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error:Unable to set the visible property of the PivotItem class. (https://www.excelbanter.com/excel-programming/337384-error-unable-set-visible-property-pivotitem-class.html)

Holger Pietsch

Error:Unable to set the visible property of the PivotItem class.
 
I got the error
Unable to set the visible property of the PivotItem class.

when i try to set a pivotitem to visible:
Dim PF As PivotField
Dim PFI As PivotItem
For Each PF In PFs
Set PFs = ActiveSheet.PivotTables("PivotTable2").PivotFields
For Each PFI In PF.HiddenItems
PFI.Visible = True
Next PFI
Next PF

is there any solution, I have found yet no such (only at
http://www.experts-exchange.com/msof..._20275761.html
, but they wanted me to register first...)

Thanks
Holger

Tom Ogilvy

Error:Unable to set the visible property of the PivotItem class.
 
See Debra Dalgleish's site

http://www.contextures.com/xlPivot03.html

Note that in her sample code she sets the autosort to manula before
unhidding the item, so this must be some bug she is allowing for:

Sub PivotShowItemAllVisible()
'sort is set to Manual to prevent errors, e.g.
'unable to set Visible Property of PivotItem class
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
For Each pf In pt.RowFields
pf.AutoSort xlManual, pf.SourceName
For Each pi In pf.PivotItems
pi.Visible = True
Next pi
pf.AutoSort xlAscending, pf.SourceName
Next pf
Next pt
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
-- Regards,Tom Ogilvy
"Holger Pietsch" wrote in message
...
I got the error
Unable to set the visible property of the PivotItem class.

when i try to set a pivotitem to visible:
Dim PF As PivotField
Dim PFI As PivotItem
For Each PF In PFs
Set PFs = ActiveSheet.PivotTables("PivotTable2").PivotFields
For Each PFI In PF.HiddenItems
PFI.Visible = True
Next PFI
Next PF

is there any solution, I have found yet no such (only at
http://www.experts-exchange.com/msof..._20275761.html
, but they wanted me to register first...)

Thanks
Holger




Holger Pietsch

Error:Unable to set the visible property of the PivotItem clas
 
Hi Tom,

the example works fine. I am now trying to get my stuff running.

Thanks a lot.
Holger

"Tom Ogilvy" wrote:

See Debra Dalgleish's site

http://www.contextures.com/xlPivot03.html

Note that in her sample code she sets the autosort to manula before
unhidding the item, so this must be some bug she is allowing for:

Sub PivotShowItemAllVisible()
'sort is set to Manual to prevent errors, e.g.
'unable to set Visible Property of PivotItem class
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
For Each pt In ActiveSheet.PivotTables
For Each pf In pt.RowFields
pf.AutoSort xlManual, pf.SourceName
For Each pi In pf.PivotItems
pi.Visible = True
Next pi
pf.AutoSort xlAscending, pf.SourceName
Next pf
Next pt
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
-- Regards,Tom Ogilvy
"Holger Pietsch" wrote in message
...
I got the error
Unable to set the visible property of the PivotItem class.

when i try to set a pivotitem to visible:
Dim PF As PivotField
Dim PFI As PivotItem
For Each PF In PFs
Set PFs = ActiveSheet.PivotTables("PivotTable2").PivotFields
For Each PFI In PF.HiddenItems
PFI.Visible = True
Next PFI
Next PF

is there any solution, I have found yet no such (only at
http://www.experts-exchange.com/msof..._20275761.html
, but they wanted me to register first...)

Thanks
Holger






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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com