Hi,
I tried to use the event to update or change the CurrentPage of a PT. As I did that, the pt went crazy like ran into a endless loop, with frequent flash of the screen. As I hit ESC, and checked Debug, I got a 1004: Unable to set number format property of the PivotField class, things like that.
This is not the first time that happened to me.
Thanks in advance.
Here is the Code.
Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Call TcShare
Call TRx
End Sub
Sub TRx()
For i = 1 To 6
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Sum of trx" & i)
.Calculation = xlNormal
.NumberFormat = "#,##0"
End With
Next
End Sub
Sub TcShare()
Dim pt As PivotTable
Set pt = ActiveSheet.PivotTables("PivotTable1")
pt.PivotFields("Mkt").CurrentPage = CStr(Range("M2").Value)
End Sub
I tried to use the event to update or change the CurrentPage of a PT. As I did that, the pt went crazy like ran into a endless loop, with frequent flash of the screen. As I hit ESC, and checked Debug, I got a 1004: Unable to set number format property of the PivotField class, things like that.
This is not the first time that happened to me.
Thanks in advance.
Here is the Code.
Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Call TcShare
Call TRx
End Sub
Sub TRx()
For i = 1 To 6
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Sum of trx" & i)
.Calculation = xlNormal
.NumberFormat = "#,##0"
End With
Next
End Sub
Sub TcShare()
Dim pt As PivotTable
Set pt = ActiveSheet.PivotTables("PivotTable1")
pt.PivotFields("Mkt").CurrentPage = CStr(Range("M2").Value)
End Sub