Pivot Table Macro, exclude possible blanks

M

mcm52188

Hello,

I've created a macro that makes a pivot table from a certain data set. This
works except that sometimes the data set contains (blank) and (""). To
exclude these from the pivot table, I have this code in place..

With ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"Consolidated Cost Center")
.PivotItems("").Visible = False
.PivotItems("(blank)").Visible = False
End With

However, sometimes the data set does not have any (blank) or (""), in which
case the macro will get this error,

Run-time error '1004':
Unable to get the PivotItems Property of the PivotField class

Is there a way to make the macro skip the code if there are no (blank) or
("")?

I am using Excel 2000.

Thanks in advance!

Marshall
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top