PivotTable field name is not valid????

wisemank

Board Regular
Joined
Jun 21, 2010
Messages
129
Anyone seen this?

Run-Time Error 1004?

I want to name the pivot tables so they are consistant and macro errors out. How would I fix?

Code:

' Turn off screen updating so the macro will run quicker
Application.ScreenUpdating = False
' Turn off auto re-calculation
Application.Calculation = xlManual


'Sheets("Original Detailed BOM").Select
Sheets("Base Vehicle Summary").Visible = True
Sheets("VSC to FGA").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"'VSC to FGA'!R1C1:R1048576C32", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="'Base Vehicle Summary'!R3C1", TableName:= _
"PivotVSC", DefaultVersion:=xlPivotTableVersion14
Sheets("Base Vehicle Summary").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotVSC").PivotFields("Macro System")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotVSC").AddDataField ActiveSheet.PivotTables( _
"PivotVSC").PivotFields("Ext Status (USD)"), "Count of Ext Status (USD)", _
xlCount
With ActiveSheet.PivotTables("PivotVSC").PivotFields( _
"Count of Ext Status (USD)")
.Caption = "Sum of Ext Status (USD)"
.Function = xlSum
End With
With ActiveSheet.PivotTables("PivotVSC").PivotFields("Macro System")
.PivotItems("(blank)").Visible = False
End With
Range("B4:B11").Select
Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
If the error is about invalid field names, you need to check your column headers, not the pivot table name. do you have any blank cells in row 1 for example?
 
Upvote 0
You were right, the exported file had failed and theh header was removed. THanks for the help. Again.....:biggrin:
 
Upvote 0

Forum statistics

Threads
1,215,409
Messages
6,124,743
Members
449,186
Latest member
HBryant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top