+ Reply to Thread
Results 1 to 3 of 3

pivot table within macro

  1. #1
    Registered User
    Join Date
    12-12-2006
    Posts
    63

    pivot table within macro

    I'm using a macro to format some data and then put it into a pivot table. The data will have the same number of columns each time but the number of rows will vary. Can this variation be accomodated within the macro?

    any help appreciated.
    Liam

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    The simplest way is to use a dynamic named range and set up the Pivot Table using the Excel menus.

    This uses the example in Excel help topic 'About PivotTable reports', with column headings in A1, B1 & C1.

    1. Create a dynamic named range e.g. 'PivotTableData' that refers to the data to analyse.
    Insert > Name > Define - PivotTableData
    Refers to: =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),3)

    2. Create the PivotTable using the PivotTable wizard on the Data menu.
    In step 2 of the wizard - 'Where is the data you want to use', set the Range to the name defined in step 1 - PivotTableData)

    3. In the macro, use the following code to refresh the PivotTable:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-12-2006
    Posts
    63
    many thanks for your help.

    regards
    Liam

+ 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