Rodney Coello
New Member
i'm trying to set up a vba code that will format any pivot table to "pivotstylemedium2"
what am i doing wrong? can you advice? thanks,
Option Explicit
Sub Macro1()
'
' Macro1 Macro
'
'
Dim df As PivotField
' Ignore errors
On Error Resume Next
'
For Each df In ActiveSheet.PivotTables(1).DataFields
ActiveSheet.PivotTables("PivotTable").TableStyle2 = "PivotStyleMedium2"
Next df
End Sub
what am i doing wrong? can you advice? thanks,
Option Explicit
Sub Macro1()
'
' Macro1 Macro
'
'
Dim df As PivotField
' Ignore errors
On Error Resume Next
'
For Each df In ActiveSheet.PivotTables(1).DataFields
ActiveSheet.PivotTables("PivotTable").TableStyle2 = "PivotStyleMedium2"
Next df
End Sub