D
Dustin B
So I have written up some code in VBA that basically takes some sloppy input
files (system reports) and formats them, adds in some new fields for more
info and creates pivot tables. In each of the pivot tables year is the
column field. My original problem was that "blank" would appear in this
field. That was easily fixed by adding this to the code of each table
creation:
With ActiveChart.PivotLayout.PivotTable.PivotFields("Year")
..PivotItems("(blank)").Visible = False
End With
Now the only problem with my fix is that if "blank" is not in the field it
will error out. Is there something similar to the below that will only make
blank visible = false if blank exists?
With ActiveChart.PivotLayout.PivotTable.PivotFields("Year")
If .PivotItems("(blank").Exists = True Then
.PivotItems("(blank)").Visible = False
End If
End With
files (system reports) and formats them, adds in some new fields for more
info and creates pivot tables. In each of the pivot tables year is the
column field. My original problem was that "blank" would appear in this
field. That was easily fixed by adding this to the code of each table
creation:
With ActiveChart.PivotLayout.PivotTable.PivotFields("Year")
..PivotItems("(blank)").Visible = False
End With
Now the only problem with my fix is that if "blank" is not in the field it
will error out. Is there something similar to the below that will only make
blank visible = false if blank exists?
With ActiveChart.PivotLayout.PivotTable.PivotFields("Year")
If .PivotItems("(blank").Exists = True Then
.PivotItems("(blank)").Visible = False
End If
End With