HELP: Error Occurs With Macro Making a Pivot Field Visible

C

Clinton M James

Hi All,

In code is the following line:

Sheets("Pivot").PivotTables("PivotTable3").PivotFields("AS_AT").PivotItems(lastDay).Visible
= True

Where lastday is a string of the last day of the previous month and is a
valid pivot table field - when recorded the macro actually records the above
line except the car lastday is the actual name.

However, every time this code is run an error occurs - Run Time Error 1004:
Unable to get the PivotItems property of the PivotField class.

Even when reocrding and re-running the recorded macro the same error occurs,
which is bizarre seeming excel provided the code itself.

This is in Excel 2007.

If anybody is able to assist fix or work around this error, it would be
greatly appreciated.

Thank you in advance.

Regards,
Clint
 

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