+ Reply to Thread
Results 1 to 2 of 2

selecting variable rows in a macro that creates a pivot table

  1. #1
    amarch00
    Guest

    selecting variable rows in a macro that creates a pivot table


    I'm trying to create a multi-consolidation range pivot table via a
    macro. Each time I run the macro the number of rows will be different.
    The macro is currently hardcoding the source data into a fixed range
    for column and row. See below.

    How do I change this to allow for a variable row selection?

    ActiveWorkbook.PivotCaches.Add(SourceType:=xlConsolidation,
    SourceData:= _
    Array("'EAG Original'!R1C2:R82C6")).CreatePivotTable
    TableDestination:="", _
    TableName:="PivotTable15"


    --
    amarch00
    ------------------------------------------------------------------------
    amarch00's Profile: http://www.officehelp.in/member.php?userid=12
    View this thread: http://www.officehelp.in/showthread.php?t=632902
    Visit - http://www.officehelp.in/archive/index.php/


  2. #2
    Debra Dalgleish
    Guest

    Re: selecting variable rows in a macro that creates a pivot table

    You could use a dynamic range as the pivot source, and refer to the
    range name in the code. There are instructions here:

    http://www.contextures.com/xlPivot01.html


    amarch00 wrote:
    > I'm trying to create a multi-consolidation range pivot table via a
    > macro. Each time I run the macro the number of rows will be different.
    > The macro is currently hardcoding the source data into a fixed range
    > for column and row. See below.
    >
    > How do I change this to allow for a variable row selection?
    >
    > ActiveWorkbook.PivotCaches.Add(SourceType:=xlConsolidation,
    > SourceData:= _
    > Array("'EAG Original'!R1C2:R82C6")).CreatePivotTable
    > TableDestination:="", _
    > TableName:="PivotTable15"
    >
    >



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


+ 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