Hi,
What is the exact code which will give me Sum instead of Count for a
Pivot Field?
I have used following code but it gave me error
Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;).Pivot Fields(quot;Durationquot;).Orientation
= xlDataField
Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;).Pivot Fields(quot;Durationquot;).Function
= xlSum
I got the following error
Run-time error '1004'
Unable to set the Function property of the PivotField classCan you help me?
Regards--
hiunnati
You could use code similar to this:
'==========================
Sub PivotTest()
Dim pt As PivotTable
Dim pf As PivotField
Set pt = Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;)
Set pf = pt.PivotFields(quot;Durationquot;)
With pf
.Orientation = xlDataField
.Function = xlSum
End With
End Sub
'===================
hiunnati wrote:
gt; Hi,
gt;
gt; What is the exact code which will give me Sum instead of Count for a
gt; Pivot Field?
gt;
gt; I have used following code but it gave me error
gt;
gt; Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;).Pivot Fields(quot;Durationquot;).Orientation
gt; = xlDataField
gt;
gt; Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;).Pivot Fields(quot;Durationquot;).Function
gt; = xlSum
gt;
gt; I got the following error
gt;
gt; Run-time error '1004'
gt;
gt; Unable to set the Function property of the PivotField class
gt;
gt;
gt; Can you help me?
gt;
gt; Regards
gt;
gt;--
Debra Dalgleish
Contextures
www.contextures.com/tiptech.html
Thanks!!!
It works
Debra Dalgleish Wrote:
gt; You could use code similar to this:
gt;
gt; '==========================
gt; Sub PivotTest()
gt; Dim pt As PivotTable
gt; Dim pf As PivotField
gt;
gt; Set pt = Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;)
gt; Set pf = pt.PivotFields(quot;Durationquot;)
gt;
gt; With pf
gt; .Orientation = xlDataField
gt; .Function = xlSum
gt; End With
gt; End Sub
gt; '===================
gt;
gt; hiunnati wrote:
gt; Hi,
gt;
gt; What is the exact code which will give me Sum instead of Count for a
gt; Pivot Field?
gt;
gt; I have used following code but it gave me error
gt;
gt;
gt; Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;).Pivot Fields(quot;Durationquot;).Orientation
gt; = xlDataField
gt;
gt;
gt; Sheets(quot;Summaryquot;).PivotTables(quot;PivotTable1quot;).Pivot Fields(quot;Durationquot;).Function
gt; = xlSum
gt;
gt; I got the following error
gt;
gt; Run-time error '1004'
gt;
gt; Unable to set the Function property of the PivotField class
gt;
gt;
gt; Can you help me?
gt;
gt; Regards
gt;
gt;
gt;
gt;
gt; --
gt; Debra Dalgleish
gt; Contextures
gt; www.contextures.com/tiptech.html--
hiunnati
- May 16 Wed 2007 20:37
Pivot tables
close
全站熱搜
留言列表
發表留言