ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating PivotTable SourceDate using VBA (https://www.excelbanter.com/excel-programming/401700-updating-pivottable-sourcedate-using-vba.html)

M Carman

Updating PivotTable SourceDate using VBA
 
The following code runs with no error whatsoever. However, the new datarange
in the €˜BT Inv worksheet does not get applied to the pivot table. If I put
a code break at the line following the source data update, and then back the
code up to the update to step it through manually, the source data update is
applied. It appears that only a manual update or code stepping are able to
applie the source data update to the pivot table.
€¢ Is there an error with this code preventing the application of the new
datasource?
€¢ Is there another way to update the data source that circumvents the
PivotTableWizard?

Sub IXCMixRefresh(byval LRow as Integer)

Sheets("Interconnect Mix").Activate
NexusUnprotect €˜ Unprotects worksheet containing the pivot table
Sheets("Interconnect Mix").PivotTableWizard SourceType:=xlDatabase,
SourceData:="'BT Inv'!R1C1:R" & LRow & "C15"
ActiveWorkbook.ShowPivotTableFieldList = False
Range("A1").Select
NexusProtect

End Sub

--
M Carman


All times are GMT +1. The time now is 07:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com