Hi
I am working on creating a Pivot table using VBA, my data is
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Name[/TD]
[TD]bYear
[/TD]
[TD]Gender
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Anna
[/TD]
[TD]1991
[/TD]
[TD]W
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]George
[/TD]
[TD]1981
[/TD]
[TD]M
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Sara
[/TD]
[TD]1971
[/TD]
[TD]W
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Tim
[/TD]
[TD]1961
[/TD]
[TD]M
[/TD]
[/TR]
</tbody>[/TABLE]
My code right now looks like
--------------------------------
Sub Create_Pivot_Table_From_Cache()
Dim oPC As PivotCache
Dim oPT As PivotTable
Dim oWS As Worksheet
oWS = ActiveSheet
oPC = ActiveWorkbook.PivotCaches.Create(xlDatabase, oWS.UsedRange)
oPT = oPC.CreatePivotTable(oWS.[D20], "Pivot From Cache", True)
oPT.AddFields(oPT.PivotFields("Item").Name, oPT.PivotFields("Customer").Name)
oPT.AddDataField(oPT.PivotFields("Qty"), "Quantity", xlSum)
End Sub
-------------------
But it doesn't do anything. How can the code be changed or written? I will expand this program to read in a large amount of data, so memory and speed is important. I hope for help as internet in this case is turning up bad results
(HELP!)
I am working on creating a Pivot table using VBA, my data is
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]ID
[/TD]
[TD]Name[/TD]
[TD]bYear
[/TD]
[TD]Gender
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Anna
[/TD]
[TD]1991
[/TD]
[TD]W
[/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]George
[/TD]
[TD]1981
[/TD]
[TD]M
[/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Sara
[/TD]
[TD]1971
[/TD]
[TD]W
[/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Tim
[/TD]
[TD]1961
[/TD]
[TD]M
[/TD]
[/TR]
</tbody>[/TABLE]
My code right now looks like
--------------------------------
Sub Create_Pivot_Table_From_Cache()
Dim oPC As PivotCache
Dim oPT As PivotTable
Dim oWS As Worksheet
oWS = ActiveSheet
oPC = ActiveWorkbook.PivotCaches.Create(xlDatabase, oWS.UsedRange)
oPT = oPC.CreatePivotTable(oWS.[D20], "Pivot From Cache", True)
oPT.AddFields(oPT.PivotFields("Item").Name, oPT.PivotFields("Customer").Name)
oPT.AddDataField(oPT.PivotFields("Qty"), "Quantity", xlSum)
End Sub
-------------------
But it doesn't do anything. How can the code be changed or written? I will expand this program to read in a large amount of data, so memory and speed is important. I hope for help as internet in this case is turning up bad results
(HELP!)