Hi,
I am working on a macro that is supposed to refresh a pivottable in a protected worksheet.
I put my macro bellow:
This code works until the refresh row, that raises an error 1004 Application-defined or object-defined error and asks me to end or debug.
I do not understand why and how to solve the error.
Thank you.
I am working on a macro that is supposed to refresh a pivottable in a protected worksheet.
I put my macro bellow:
Code:
Sub refresh()
'
' refresh Macro
'
'
ActiveSheet.Unprotect Password:="password"
Rows("4:6").Select
Selection.EntireRow.Hidden = False
[B]ActiveSheet.PivotTables("orderseur").PivotCache.refresh[/B]
Rows("5:5").Select
Selection.EntireRow.Hidden = True
ActiveSheet.protect Password:="password", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True, AllowUsingPivotTables:=True
End Sub
This code works until the refresh row, that raises an error 1004 Application-defined or object-defined error and asks me to end or debug.
I do not understand why and how to solve the error.
Thank you.