+ Reply to Thread
Results 1 to 1 of 1

Macro for creating Pivot

  1. #1
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Macro for creating Pivot

    Hi,

    I am looking for a Macro to create a Pivot table. The data will change every time and it should not through errors if I use the same Macro.

    I have tried and getting the below error. Its working for the same work book for not the new data, Please help.
    ----------------------------------------------------------------------------------------------------------------------------------
    Sub Pradeep()
    '
    ' Pradeep Macro
    ' Test for Pivot
    '

    '
    Sheets.Add
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Report!R1C1:R3360C11", Version:=xlPivotTableVersion10).CreatePivotTable _
    TableDestination:="Sheet1!R3C1", TableName:="PivotTable1", DefaultVersion _
    :=xlPivotTableVersion10

    Sheets("Sheet1").Select
    Cells(3, 1).Select
    ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
    "PivotTable1").PivotFields("Ticket Number"), "Count of Ticket Number", xlCount
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Assigned To Group")
    .Orientation = xlRowField
    .Position = 1
    End With
    With ActiveSheet.PivotTables("PivotTable1").PivotFields("Status")
    .Orientation = xlColumnField
    .Position = 1
    End With
    End Sub


    Thanks in advance for all your help!!

    Regards,
    Pradeep Kodali
    Last edited by pradeepkodali; 08-31-2011 at 04:52 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1