Private
Sub
CheckBox2_Click()
If
Sheets(
"Auswahlbildschirm"
).CheckBox2.Value =
True
Then
Sheets(
"57005313"
).
Select
Set
ptCache = ActiveWorkbook.PivotCaches.Add _
(SourceType:=xlDatabase, _
SourceData:=
"A1:V"
& _
ActiveSheet.UsedRange.Rows.Count)
Sheets(
"Auswertung VE13-14"
).
Select
Set
pttable = ptCache.CreatePivotTable(TableDestination:=ActiveSheet.Range(
"F2"
), tablename:=
"VE14-M160"
)
With
pttable
.PivotFields(
"Auswahlcluster"
).Orientation = xlRowField
.PivotFields(
"SAP Baugruppe"
).Orientation = xlRowField
.PivotFields(
"Bezeichnung Baugruppe"
).Orientation = xlRowField
.PivotFields(
"Bestandsänderung"
).Orientation = xlDataField
End
With
Columns(
"A:N"
).AutoFit
Set
ptCache =
Nothing
Set
pttable =
Nothing
Else
End
If
End
Sub