Hi all,
Basically I am trying to rebuild pivot tables, which basically means adding back the 'value' field. They were working independently which was why they were written in such a manner, but failed when all together in a single procedure. Yet when I call to each I get errors.. Errors which were not happening when they were run on their own. These were recorded and proved working at the time.. Any advice much appreciated..
Error appears again and again on following :
ActiveSheet.PivotTables("Forecast_Master_Cost").AddDataField ActiveSheet. _
PivotTables("Forecast_Master_Cost").CubeFields( _
"[Measures].[Sum of Actual Cost]"), "Sum of Actual Cost"
Whole code...
Sub Forecast_N1()
'
' Forecast_N1 Macro
'
Application.ScreenUpdating = False
Worksheets("Forecast").Activate
ActiveSheet.PivotTables("Forecast_Planned_NONGEN").AddDataField ActiveSheet. _
PivotTables("Forecast_Planned_NONGEN").CubeFields( _
"[Measures].[Sum of Planned Work Days]"), "Sum of Planned Work Days"
With ActiveSheet.PivotTables("Forecast_Planned_NONGEN").PivotFields( _
"[Measures].[Sum of Planned Work Days]")
.NumberFormat = "0.00"
End With
Call Forecast_N3
End Sub
Sub Forecast_N2()
'
' Forecast_N1 Macro
'
Application.ScreenUpdating = False
Worksheets("Forecast").Activate
ActiveSheet.PivotTables("Forecast_Planned_GENERIC_ONLY").AddDataField ActiveSheet. _
PivotTables("Forecast_Planned_GENERIC_ONLY").CubeFields( _
"[Measures].[Sum of Planned Work Days]"), "Sum of Planned Work Days"
With ActiveSheet.PivotTables("Forecast_Planned_GENERIC_ONLY").PivotFields( _
"[Measures].[Sum of Planned Work Days]")
.NumberFormat = "0.00"
End With
Call Forecast_N3
End Sub
Sub Forecast_N3()
'
' Forecast_N3 Macro
'
Application.ScreenUpdating = False
Worksheets("Forecast").Activate
ActiveSheet.PivotTables("Forecast_Base_NOGENERICS").AddDataField ActiveSheet. _
PivotTables("Forecast_Base_NOGENERICS").CubeFields( _
"[Measures].[Sum of BaseCapacity Days]"), "Sum of BaseCapacity Days"
With ActiveSheet.PivotTables("Forecast_Base_NOGENERICS").PivotFields( _
"[Measures].[Sum of BaseCapacity Days]")
.Caption = "Base Capacity Days"
.NumberFormat = "#,##0.00"
End With
Call Forecast_N4
End Sub
[/CODE]
Bookmarks