View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default 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").Refresh Table
End Sub

--
Regards,
Tom Ogilvy


"Mike_M" wrote in message
oups.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