G
Geoff
A pivottable produces as an example:
Company Operation Cost
thisone day 13.50
1. What syntax should I use to reference the value of 13.50?
2. When creating the pivottable how can I change this value to 0
yet leave the wsheet value unchanged?
The pivottable code yields:
Set pt = Sheets(5).PivotTables("PivotTable2")
pt.Name '= PivotTable2
pt.RowFields(2).Name '= Company
pt.RowFields(2).PivotItems(2).Name '= thisone
pt.RowFields(1).Name '= Operation
pt.RowFields(1).PivotItems(1).Name '= day
pt. ???????????? '= 13:50
In the pivotfield code:
With pt.PivotFields("Cost")
.Value = 0 ' doesn't work
.Orientation = xlDataField
.Position = 1
.Function = xlSum
.NumberFormat = "#,##0.00 "
End With
The wsheet values are:
pt.PivotFields(16).Name '= Company
pt.PivotFields(32).Name '= Cost
pt.PivotFields(32).PivotItems(1).Value '= 0.00
pt.PivotFields(32).PivotItems(2).Value '= 13.50
pt.PivotFields(32).PivotItems(3).Value '= 27.00
pt.PivotFields(32).PivotItems(4).Value '= 49.50
T.I.A.
Geoff
Company Operation Cost
thisone day 13.50
1. What syntax should I use to reference the value of 13.50?
2. When creating the pivottable how can I change this value to 0
yet leave the wsheet value unchanged?
The pivottable code yields:
Set pt = Sheets(5).PivotTables("PivotTable2")
pt.Name '= PivotTable2
pt.RowFields(2).Name '= Company
pt.RowFields(2).PivotItems(2).Name '= thisone
pt.RowFields(1).Name '= Operation
pt.RowFields(1).PivotItems(1).Name '= day
pt. ???????????? '= 13:50
In the pivotfield code:
With pt.PivotFields("Cost")
.Value = 0 ' doesn't work
.Orientation = xlDataField
.Position = 1
.Function = xlSum
.NumberFormat = "#,##0.00 "
End With
The wsheet values are:
pt.PivotFields(16).Name '= Company
pt.PivotFields(32).Name '= Cost
pt.PivotFields(32).PivotItems(1).Value '= 0.00
pt.PivotFields(32).PivotItems(2).Value '= 13.50
pt.PivotFields(32).PivotItems(3).Value '= 27.00
pt.PivotFields(32).PivotItems(4).Value '= 49.50
T.I.A.
Geoff