So I'm running into an issue with some VBA code which states that if the source data changes, refresh the pivot table. If you look at image1 source, the pivot table in "Sheet 7" refresh fine if I manually change the week in A2. Which is great, the code is running in the "Calculation" sheet and as stated when you update the week number the pivot table refreshes.
The problem is in the sheet "AMS (for product)" I have a scroll bar (Image 2 course) that changes the week number in sheet "Calculation" and ultimately updates the data based on the week it is. When I use the scroll bar to update the number, the pivot table data does not refresh when the source data changes. I tried to copy paste the same code I put into "Calculation" but it doesn't seem to have an effect.
Private Sub Worksheet_Change(ByVal Target As Range)
Sheet4.PivotTables("PivotTable3").PivotCache.Refresh
End Sub
The problem is in the sheet "AMS (for product)" I have a scroll bar (Image 2 course) that changes the week number in sheet "Calculation" and ultimately updates the data based on the week it is. When I use the scroll bar to update the number, the pivot table data does not refresh when the source data changes. I tried to copy paste the same code I put into "Calculation" but it doesn't seem to have an effect.
Private Sub Worksheet_Change(ByVal Target As Range)
Sheet4.PivotTables("PivotTable3").PivotCache.Refresh
End Sub