OLE2 PIVOT TABLE [message #402218] |
Fri, 08 May 2009 02:19 |
kris312566
Messages: 9 Registered: May 2009 Location: Mumbai
|
Junior Member |
|
|
Hi,
i want to create an pivot table using forms 6i ole2, i know i can do the same with matrix report but i want it from ole2.
Thanks
|
|
|
|
|
|
Re: OLE2 PIVOT TABLE [message #403661 is a reply to message #403640] |
Sun, 17 May 2009 23:34 |
kris312566
Messages: 9 Registered: May 2009 Location: Mumbai
|
Junior Member |
|
|
Here is the code for creating an Pivot Table From The existing data in vb i don't know how to pass these multiple parameter in same command so if u please give me sample code that will be real help.
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R8C3", Version:=xlPivotTableVersion12).CreatePivotTable _
TableDestination:="Sheet1!R1C10", TableName:="PivotTable1", DefaultVersion _
:=xlPivotTableVersion12
Sheets("Sheet1").Select
Cells(1, 10).Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Sport")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Quarter")
.Orientation = xlColumnField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Sales"), "Sum of Sales", xlSum
|
|
|
|
|