I needed to add a bunch of calculated data fields to pivot tables. It was getting to be a pain in the butt to do it through the GUI after the umpteenth time, so I decided to record a macro and script it.
It worked the first time around and failed the second time.
The first time around, I essentially ran this block of code incremented about 20-30 times (just one macro)
This appeared to work very well. I tried to repeat my previous success, but failed.
I copied the worksheet that contained the pivot table mentioned above and ran this block of code incremented 20-30 times. This time around, I changed the calculation a bit and changed the number format.
For some reason it fails at line 4 and returns this error message:
"unable to get the pivotfields property of the pivottable class"
Any ideas? Thanks!
Bookmarks