+ Reply to Thread
Results 1 to 3 of 3

Macro to update pivot table data range

  1. #1
    Mike_M
    Guest

    Macro to update pivot table data range

    Does anyone have a quick macro that goes an updates the data range for
    a pivot table? At present, additional data rows are being added to the
    data set which are below and outside of the data range previously
    defined. The data is on a different worksheet to the pivot table. I
    would like to simply assign this macro to a button next to the pivot
    table so that the user spends no time manually updating the data range
    to include the additional rows added each month.

    Thanks

    Mike


  2. #2
    Tom Ogilvy
    Guest

    Re: Macro to update pivot table data range

    the easiest way is to use a dynamic range to define the database

    Insert=>Name=>Define

    Name: MyData
    Refersto: =Offset(Sheet3!$A$1,0,0,CountA(Sheet3!$A:$A),10)


    then make that the source for you pivot table. Now, whenever the user
    refreshes the data, it will use the expanded range.

    If you want to have your button refresh the data, the code would be

    Private Sub CommandButton1_Click()
    worksheets("Sheet1").PivotTables("Table1").RefreshTable
    End Sub

    --
    Regards,
    Tom Ogilvy


    "Mike_M" <moran_mc@yahoo.com> wrote in message
    news:1117013785.877160.178150@g14g2000cwa.googlegroups.com...
    > Does anyone have a quick macro that goes an updates the data range for
    > a pivot table? At present, additional data rows are being added to the
    > data set which are below and outside of the data range previously
    > defined. The data is on a different worksheet to the pivot table. I
    > would like to simply assign this macro to a button next to the pivot
    > table so that the user spends no time manually updating the data range
    > to include the additional rows added each month.
    >
    > Thanks
    >
    > Mike
    >




  3. #3
    Mike_M
    Guest

    Re: Macro to update pivot table data range

    Thanks - much appreciated


+ 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