Consulting

Results 1 to 3 of 3

Thread: Trouble with Pivot table

  1. #1

    Trouble with Pivot table

    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

  2. #2
    VBAX Regular
    Joined
    Apr 2009
    Posts
    32
    Location
    Quote Originally Posted by Chandrasheka
    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 Line

    [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

  3. #3
    Hi,

    Thank you its working fine.

    Regards,

    Chandra Shekar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •