ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code Will Not Run (https://www.excelbanter.com/excel-programming/338947-code-will-not-run.html)

S Jackson

Code Will Not Run
 
I have a simple workbook that contains a pivot table worksheet. On that
worksheet I inserted the following code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.PivotTables(2).PivotCache.Refresh

End Sub

It does not work. It does not appear to be executing at all. When excel
opens the workbook, I do not get a warning about macros. How do I fix this
to get the code to run?

S. Jackson



S Jackson

Code Will Not Run
 
I just realized that I had the code wrong and changed it, but the code will
still not run. It will run just fine on the sample TimeChart.xls file I
downloaded from http://www.contextures.com/excelfiles.html#Pivot

Here is the code I have on the worksheet containing the pivot table (fyi,
the source table is on a different sheet):

Private Sub Worksheet_Activate()
ActiveSheet.PivotTables(1).PivotCache.Refresh
End Sub


"S Jackson" wrote in message
...
I have a simple workbook that contains a pivot table worksheet. On that
worksheet I inserted the following code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ActiveSheet.PivotTables(2).PivotCache.Refresh

End Sub

It does not work. It does not appear to be executing at all. When excel
opens the workbook, I do not get a warning about macros. How do I fix

this
to get the code to run?

S. Jackson






All times are GMT +1. The time now is 10:08 AM.

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