Hi everyone,

I'm working on reporting data form Cube into a macro with pivot tables, but i keep getting this "Run time error 1004 : Unable to get the Pivot Table property of the worksheet class" as it highlights "ActiveSheet.PivotTables("PivotTable1").RowAxisLayout xlTabularRow" the 1rst code sentence.

Could you please help me figure out why and how to solve this please? I've checked the pivot table's name and it matches..Maybe it's to do with several user using Cube and this databse..I really have no clue, I'm new at this. Thank you!


[code]

Sub Macro2()
'
' Macro2 Macro
'

'
ActiveSheet.PivotTables("PivotTable1").RowAxisLayout xlTabularRow
With ActiveSheet.PivotTables("PivotTable1").CubeFields( _
"[Claim - Case].[Operational Case Reference]")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").CubeFields( _
"[Claim - Case].[Case Operational Type Full Label]")
.Orientation = xlRowField
.Position = 2
End With
Range("A6").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Claim - Case].[Operational Case Reference].[Operational Case Reference]"). _
Subtotals = Array(False, False, False, False, False, False, False, False, False, False, _
False, False)
Range("B7").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields( _
"[Claim - Case].[Case Operational Type Full Label].[Case Operational Type Full Label]" _
).Subtotals = Array(False, False, False, False, False, False, False, False, False, False _
, False, False)
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").CubeFields("[Measures].[Business - Cases count]")
End Sub

[code]

I appreciate any comment, so don't hesitate!thank you!