Results 1 to 10 of 10

VBA code error

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-11-2008
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    242

    VBA code error

    Hi,
    I am trying to create this dynamic pivot table but I am getting multiple error,pls help me in debugging it.I am attaching the pivot picture for your persual.

    Sub Pivot_with_Dynamic_range()
    ' This creates Dynamic data range named "PvtData"
    
    ActiveWorkbook.Names.Add Name:="PvtData", RefersToR1C1:= _
    "=OFFSET('Data'!R2C1,0,0,COUNTA('Data'!C1),COUNTA('Data'!R2))"
    
    ' This creates Pivot using Dynamic data range named "PvtData"
    
    ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
    "PvtData").CreatePivotTable TableDestination:="", TableName:="PivotTable1"
    ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
    ActiveSheet.Cells(3, 1).Select
    ActiveSheet.PivotTables("PivotTable1").SmallGrid = False
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("Organization Name")
            .Orientation = xlRowField
            .Position = 1
        End With
        ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
            "PivotTable1").PivotFields("Value"), "Sum of Value", xlSum
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("logic")
            .Orientation = xlColumnField
            .Position = 1
        End With
        Range("H10").Select
    End Sub
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by arnab0711; 03-23-2010 at 09:49 AM.

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