Hi,
Please find attached file I am facing problem in pivot table please run the code and see the result, I am not getting list only.
Thanks
Hi,
Please find attached file I am facing problem in pivot table please run the code and see the result, I am not getting list only.
Thanks
I am Not a Expert, Change the Colored LineOriginally Posted by Chandrasheka
[vba]Sub pivot_creation()
Dim pvt_che As PivotCache
Dim pvt_tbl As PivotTable
lstrw_sh1 = ThisWorkbook.Worksheets(1).Range("C" & Rows.Count).End(xlUp).Row
Set Rng = Sheet1.Range("B1" & ":" & "C" & lstrw_sh1)
Set pvt_che = ThisWorkbook.PivotCaches.Add(xlDatabase, Rng)
Set pvt_tbl = pvt_che.CreatePivotTable(Worksheets(3).Range("A1"))
ThisWorkbook.ShowPivotTableFieldList = True
With pvt_tbl.PivotFields("Name")
.Orientation = xlRowField
.Position = 1
End With
With pvt_tbl
.AddDataField pvt_tbl.PivotFields("Cat Name"), "CatName", xlCount
End With
ThisWorkbook.ShowPivotTableFieldList = False
Application.CommandBars("PivotTable").Visible = False
Set pvt_che = Nothing
Set pvt_tbl = Nothing
End Sub
[/vba]
Last edited by Aussiebear; 10-16-2010 at 01:21 AM. Reason: Adjusted correct code tags for User
Hi,
Thank you its working fine.
Regards,
Chandra Shekar