RUN TIME ERROR 1004--The PivotTable field name is not valid.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All experts,

I urgently need help to resolve this problem.

The macro to create the pivot table had worked fine until a change of the
hard coded location of the data source - just file path changes.

When run the macro again, I got a error message:

Run-time error "1004"

The PivotTable field name is not valid. To create a PivotTable, 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.


If I click Debug, I got another error message:

Out of memory.

I have to click OK on the message box 3 times to get the debug mode.

The code is as the follows:

Selection.CurrentRegion.Select
Selection.Name = "GO"

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"GO").CreatePivotTable TableDestination:="" _
, TableName:="PivotTable4"

Any ideas and suggestions will be very much appreciated.

Linda
 
Back
Top