![]() |
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 |
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 |
Macro to update pivot table data range
Thanks - much appreciated
|
All times are GMT +1. The time now is 08:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com