user3420361
user3420361

Reputation: 53

excel run-time error 1004 pivot table field name is not valid

Good day everyone!

I got run-time error 1004 pivot table field name is not valid in EXCEL

I have dynamic data range from Infolog Data!R2C1:R3800C24 is valid, on 1 pc it work on other 3 pc dosent work, and I can't understand why... Office 2013

Sub Creation_of_list_planning()


        Application.DisplayAlerts = False  
        Sheets("Planning").Delete           
        Application.DisplayAlerts = True   

        Worksheets.Add After:=Worksheets(Worksheets.Count)
        Worksheets(Worksheets.Count).Name = "Planning"

End Sub

In debug I got error in this part:

Sub Creation_of_table()

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Infolog Data!R2C1:R3800C24",            Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Planning!R1C1", TableName:="Planning", DefaultVersion:= _
        xlPivotTableVersion14

Upvotes: 1

Views: 4236

Answers (1)

Rory
Rory

Reputation: 34045

Your SourceData command is missing some apostrophes required due to the spaces in the sheet name:

SourceData:= _
"'Infolog Data'!R2C1:R3800C24"

There also needs to be a valid header in A2:X2 on that sheet.

Upvotes: 2

Related Questions