I'm currently trying to use an inherited excel macro.
I did not write it (and would not have the skills to write VB either)
But i've been getting a number of errors while running this code. I've got through a lot of them but now can't figure this one out.
The error that comes up on screen says:
Run-time error 1004
The PivotTable field name is not valid. To create a PivotTable report, you must use data that is organized as a list with labeled columns. If you are changing the name of a PivotTable field, you must type a new name for the field.
And when I go to debug it, the error is in this section (pt.RefreshTable is highlighted)
Sub AllWorkbookPivots() Dim pt As PivotTable Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets For Each pt In ws.PivotTables pt.RefreshTable Next pt Next ws End Sub
Does anyone know what might be causing this error?
I'm sure its something very simple and straight forward but I do not have much experience in VB so any help is appreciated.
Edited 4 Years Ago by niall_heavey