03856me
Active Member
- Joined
- Apr 4, 2008
- Messages
- 297
I have a pivot table with date as a page field. I have the following code which works on the surface, it does change the page field to the most recent date that is stored in cell H7. But the pt does not change - it is not recognizing the date. I tried refreshing again but it changes the date field to ALL. Could you take a look at my code and let me know what I can change. Ideally I would like the max date to be part of the code but have not been able to figure it out.
The formula that is in H7 is =MAX(sumdataTable[date],0)
The formula that is in H7 is =MAX(sumdataTable[date],0)
Code:
Private Sub Worksheet_Activate()
ActiveSheet.PivotTables(1).PivotCache.Refresh
maxDateValue
End Sub
Sub maxDateValue()
ActiveSheet.PivotTables("dprPT").PivotFields("date").CurrentPage _
= Range("H7").Value
ActiveSheet.PivotTables(1).PivotCache.Refresh
End Sub