```
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
Range(Sheets("HPMN").Cells(1, 1), Sheets("HPMN").Cells(nLastRow, nLastCol)), Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="HPMN!R1C1", TableName:="HPMN Codes", DefaultVersion:= _
xlPivotTableVersion12
Sheets("HPMN").Select
Cells(1, 1).Select
ActiveSheet.PivotTables("HPMN Codes").AddDataField ActiveSheet.PivotTables( _
"HPMN Codes").PivotFields("TAPSeqNo"), "Min of TAPSeqNo", xlMin
ActiveSheet.PivotTables("HPMN Codes").AddDataField ActiveSheet.PivotTables( _
"HPMN Codes").PivotFields("TAPSeqNo"), "Max of TAPSeqNo", xlMax
ActiveSheet.PivotTables("HPMN Codes").AddDataField ActiveSheet.PivotTables( _
"HPMN Codes").PivotFields("TotalNetCharge"), "Sum of TotalNetCharge", _
xlSum
ActiveSheet.PivotTables("HPMN Codes").AddDataField ActiveSheet.PivotTables( _
"HPMN Codes").PivotFields("TotalTax"), "Sum of TotalTax", xlSum
With ActiveSheet.PivotTables("HPMN Codes").PivotFields("HPMN")
.Orientation = xlRowField
.Position = 1
End With
```