Excel数据透视表格式化值​​单元格

有史以来第一次。 感谢所有的回答。 许多人从你们每个人那里学到很多。

用VBA创build数据透视表。 要值区域单元(数据和标签)是; Horizo​​ntalAlignment = xlCenter。 目前的方法;

'... typical VBA code to create Pivot table; 'ActiveWorkbook.PivotCaches.Create ... 'Dim MyPT As PivotTable '... 'number format all value cells (done without selecting) MyPT.PivotFields("Sum of Bikes").NumberFormat = "#,##0.00" 'center align all value cells, data & lables (must select cells to do this) Dim pvtField As PivotField For Each pvtField In MyPT.PivotFields If pvtField = "Bikes" Then MyPT.PivotSelect "", xlDataAndLabel, True 'The PivotSelect method does not return an object. It selects a range. Selection.HorizontalAlignment = xlCenter End If Next pvtField 

任何方式来做到这一点,而不是通过PivotSelectselect范围(类似于如何应用数字格式)?