[LEFT][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']Sheets("C-Grades").Select[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
Range("O11:T500").Select[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit'] ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
"C-Grades!R11C15:R500C20", Version:=6).CreatePivotTableTableDestination:= _[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
"C-Grades!R11C24", TableName:="PivotTable1",DefaultVersion:=6[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
Sheets("C-Grades").Select[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
Cells(11, 24).Select[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
WithActiveSheet.PivotTables("PivotTable1").PivotFields("material")[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
.Orientation = xlRowField[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
.Position = 1[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
EndWith[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
ActiveSheet.PivotTables("PivotTable1").AddDataFieldActiveSheet.PivotTables( _[/FONT][/COLOR][/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']
"PivotTable1").PivotFields("C-Grades Quantity"),"Count of C-Grades Quantity", _[/FONT][/COLOR][/FONT][/COLOR][LEFT][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit']xlCount[/FONT][/COLOR][/FONT][/COLOR][/LEFT]
[COLOR=#222222][FONT=Verdana][LEFT][COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR][/LEFT]
[/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit'] WithActiveSheet.PivotTables("PivotTable1").PivotFields( _[/FONT][/COLOR][LEFT][COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR][/LEFT]
[/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit'] "Count of C-Grades Quantity")[/FONT][/COLOR][LEFT][COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR][/LEFT]
[/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit'] .Caption = "Sum of C-Grades Quantity"[/FONT][/COLOR][LEFT][COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR][/LEFT]
[/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit'] .Function = xlSum[/FONT][/COLOR][LEFT][COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR][/LEFT]
[/FONT][/COLOR][COLOR=#222222][FONT=Verdana][COLOR=#0000ff][FONT='inherit'] EndWith[/FONT][/COLOR][/FONT][/COLOR][/LEFT]