Bagharmin
Board Regular
- Joined
- Nov 22, 2010
- Messages
- 168
I have a Pivot Table that is based on data contained on another worksheet in the same workbook. The number of rows in the source data changes from time to time. I want to refresh the Pivot Table in the macro that changes the number of rows in the source data, but I keep getting an "Object doesn't support this property or method" error. Here's the code in question:
Prior to the way it currently looks, I was getting an application/object defined error. I've changed it around several times, but can't seem to get it right. There is a PivotTable ("MyPivot") and a Pivot Chart on the "Pivot" worksheet that are linked together (changing the table changes the chart as well).
Thanks so much for the help. This is all I need to finish off the macro.
Code:
CurrAddress = "[" & ActiveWorkbook.Name & "]Data Restructure!R2C1:R" & LastRow & "C7"
Worksheets("Pivot").PivotTable("MyPivot").ChangePivotCache ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=CurrAddress)
Prior to the way it currently looks, I was getting an application/object defined error. I've changed it around several times, but can't seem to get it right. There is a PivotTable ("MyPivot") and a Pivot Chart on the "Pivot" worksheet that are linked together (changing the table changes the chart as well).
Thanks so much for the help. This is all I need to finish off the macro.