Link to home
Create AccountLog in
Avatar of VBAlearner2010
VBAlearner2010Flag for France

asked on

Pivot table property in Office 2010

In the following code there is a error when i run the macro. The error comes up as

Run time error '1004'
Unable to get the pivot table property of the worksheet class.

on the line "ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotCache.Refresh"

Could anyone please send me the replacement code for this to work in Office 2010 and also if i have to do some work arounds. Since i am new to VBA i would require very basic explanations.

Thank you.
Sub actualiser()
    Range("A9").Select
    ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotCache.Refresh
    Range("A37").Select
    ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotCache.Refresh
    Sheets("Séparation pouvoirs").Select
    Range("A7").Select
    ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotCache.Refresh
    Sheets("Not Approved").Select
    Range("B10").Select
    ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotCache.Refresh
    Sheets("validation fonctionnelle").Select
    Range("A15").Select
    ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotCache.Refresh
    Sheets("Planification").Select
    Range("A12").Select
    ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotCache.Refresh
    Sheets("Jeudi 16h00").Select
    Range("A14").Select
    ActiveSheet.PivotTables("Tableau croisé dynamique1").PivotCache.Refresh
    Sheets("Execution").Select
End Sub

Open in new window

Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

That implies that either the active sheet does not have that pivot table on it, or you have the name of the pivot table wrong.
SOLUTION
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of VBAlearner2010

ASKER

@rorya : How do we check the pivot table in the excel sheet if its present or not? I am working on a different environment. Its not the live PC where the application works. So your explanation would be helpful...

@teylyn:

Thank you very much for the confirmation. Its used in the live environment in the same name for the table. Its a French environment. So they name it so.... Hope the name will not be a problem in that case. But it could be very helpful for me to know how to check in the excel to see if the pivot table is present or not....

Thank you both....
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thank you.But how do i find if the pivot table is present or not? Hope this is very basic.. But i am not aware of it...
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
@rorya... Thank you very much.. That helped really....
Got solution