Hi all,
I have a macro that sorts a pivot whenever i press a button, the problem is when i run the macro with the pivot window hidden the macro fails, can anyone give me a had on this?
See below code used:
Sub sort_pivot()
' sort_pivot Macro
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Sheets("Pivots").Select
Range("c6").Select
ActiveSheet.PivotTables("pivot#").PivotFields("field").AutoSort _
xlDescending, "Sum of ****", ActiveSheet.PivotTables( _
"pivot#").PivotColumnAxis.PivotLines(2), 1
Sheets("search").Select
Range("a1").Select
MsgBox "Sort Completed"
Application.DisplayStatusBar = True
End Sub
best regards,
Daniel
I have a macro that sorts a pivot whenever i press a button, the problem is when i run the macro with the pivot window hidden the macro fails, can anyone give me a had on this?
See below code used:
Sub sort_pivot()
' sort_pivot Macro
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Sheets("Pivots").Select
Range("c6").Select
ActiveSheet.PivotTables("pivot#").PivotFields("field").AutoSort _
xlDescending, "Sum of ****", ActiveSheet.PivotTables( _
"pivot#").PivotColumnAxis.PivotLines(2), 1
Sheets("search").Select
Range("a1").Select
MsgBox "Sort Completed"
Application.DisplayStatusBar = True
End Sub
best regards,
Daniel