K
KtM
Hi!
Can anyone find whats wrong with the following VBA, I cant seem to find
why
"With ActiveSheet.PivotTables(apuFirma & "Pivot").PivotFields("Stage")
.Orientation = xlDataField
.Caption = "Average of Stage"
.Function = xlAverage"
stops all the time.
The whole code part(relevant) is below.
Sheets(apuFirma & "Q" & qCount).Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=
_
"'" & apuFirma & "Q" & qCount & "'!A:B").CreatePivotTable
TableDestination:="", TableName:= _
"'" & apuNimi & "Pivot" & "',
DefaultVersion:=xlPivotTableVersion10"
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3,
1)
ActiveSheet.Cells(3, 1).Select
With ActiveSheet.PivotTables(apuFirma &
"Pivot").PivotFields("Stage")
.Orientation = xlDataField
.Caption = "Average of Stage"
.Function = xlAverage
End With
ActiveSheet.PivotTables(apuNimi & "Pivot").AddDataField
ActiveSheet.PivotTables( _
apuFirma & "Pivot").PivotFields("Stage"), "Count of Stage",
xlCount
Range("A3").Select
ActiveSheet.PivotTables(apuNimi & "Pivot").PivotFields("Count of
Stage").Function _
= xlAverage
Any ideas?
Can anyone find whats wrong with the following VBA, I cant seem to find
why
"With ActiveSheet.PivotTables(apuFirma & "Pivot").PivotFields("Stage")
.Orientation = xlDataField
.Caption = "Average of Stage"
.Function = xlAverage"
stops all the time.
The whole code part(relevant) is below.
Sheets(apuFirma & "Q" & qCount).Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:=
_
"'" & apuFirma & "Q" & qCount & "'!A:B").CreatePivotTable
TableDestination:="", TableName:= _
"'" & apuNimi & "Pivot" & "',
DefaultVersion:=xlPivotTableVersion10"
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3,
1)
ActiveSheet.Cells(3, 1).Select
With ActiveSheet.PivotTables(apuFirma &
"Pivot").PivotFields("Stage")
.Orientation = xlDataField
.Caption = "Average of Stage"
.Function = xlAverage
End With
ActiveSheet.PivotTables(apuNimi & "Pivot").AddDataField
ActiveSheet.PivotTables( _
apuFirma & "Pivot").PivotFields("Stage"), "Count of Stage",
xlCount
Range("A3").Select
ActiveSheet.PivotTables(apuNimi & "Pivot").PivotFields("Count of
Stage").Function _
= xlAverage
Any ideas?