M
Mike Barron
I have been trying to automate a pivot table to produce 2
standard reports from a database in a separate
spreadsheet. There are three field items which differ
between the reports. I have recorded a macro to hide the
fields and another to show them. Looking at the code
produced by these it appears simple to set the VISIBLE
property for the items to either FALSEor TRUE to show or
hide these items but although the code for hiding the
items works the macro gives an error when trying to set
the VISIBLE property to TRUE. The error is:
Run-time error 1004
Unable to setthe Visible property of the PivotItem class
An extract of the affected code is below:
With ActiveSheet.PivotTables("Rupee").PivotFields
("Activity No")
.PivotItems("14").Visible = False
.PivotItems("14.1").Visible = True
End With
Only the second one (14.1) gives the error.
Has anyone else had a similar problem and is there a
solution?
standard reports from a database in a separate
spreadsheet. There are three field items which differ
between the reports. I have recorded a macro to hide the
fields and another to show them. Looking at the code
produced by these it appears simple to set the VISIBLE
property for the items to either FALSEor TRUE to show or
hide these items but although the code for hiding the
items works the macro gives an error when trying to set
the VISIBLE property to TRUE. The error is:
Run-time error 1004
Unable to setthe Visible property of the PivotItem class
An extract of the affected code is below:
With ActiveSheet.PivotTables("Rupee").PivotFields
("Activity No")
.PivotItems("14").Visible = False
.PivotItems("14.1").Visible = True
End With
Only the second one (14.1) gives the error.
Has anyone else had a similar problem and is there a
solution?